Skip to content

Commit

Permalink
github: create draft release on tag push
Browse files Browse the repository at this point in the history
  • Loading branch information
chuahou committed Jun 14, 2021
1 parent 74b34ab commit f5be981
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions .github/workflows/artifacts.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: "build artifacts"
name: "Draft release"
on:
workflow_dispatch:
inputs:
label:
description: "Label to give artifacts"
required: true
push:
tags: v*

jobs:
linux:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -34,7 +32,7 @@ jobs:
mkdir -p artifacts
cabal install
cp $HOME/.cabal/bin/cfgeq \
artifacts/cfgeq-${{ github.event.inputs.label }}-${GITHUB_SHA}-linux
artifacts/cfgeq-$(echo ${{ github.ref }} | sed -n 's/.*\(v\([0-9]\.\)\{3\}[0-9]\)/\1/p')-${GITHUB_SHA}-linux
- uses: actions/upload-artifact@v2
with:
name: artifacts-linux
Expand All @@ -53,8 +51,31 @@ jobs:
run: |
mkdir artifacts
cabal install
cp %APPDATA%\cabal\bin\cfgeq.exe artifacts\cfgeq-${{ github.event.inputs.label }}-%GITHUB_SHA%-windows.exe
cp %APPDATA%\cabal\bin\cfgeq.exe artifacts\cfgeq.exe
- name: Rename
shell: bash
run: |
mv artifacts/cfgeq.exe \
artifacts/cfgeq-$(echo ${{ github.ref }} | sed -n 's/.*\(v\([0-9]\.\)\{3\}[0-9]\)/\1/p')-${{ github.sha }}-windows.exe
- uses: actions/upload-artifact@v2
with:
name: artifacts-windows
path: artifacts\cfgeq-*

release:
runs-on: ubuntu-latest
needs: [linux, windows]
steps:
- uses: actions/[email protected]
- name: Parse changelog
run: |
TAG=$(echo ${{ github.ref }} | sed -n 's/.*\(\([0-9]\.\)\{3\}[0-9]\)/\1/p')
sed "/^## ${TAG}/,/^##/!d; //d; /^$/d" CHANGELOG.md > CHANGES.md
- uses: actions/download-artifact@v2
- name: Draft release
uses: ncipollo/release-action@v1
with:
draft: true
artifacts: "artifacts-linux/cfgeq-*,artifacts-windows/cfgeq-*.exe"
bodyFile: CHANGES.md
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit f5be981

Please sign in to comment.