Skip to content

Commit

Permalink
ci: Add release automation process
Browse files Browse the repository at this point in the history
This commit adds a GitHub Actions release automation process that gets
triggered when a new release is published on the GitHub.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
  • Loading branch information
stephanosio committed May 26, 2020
1 parent 8f112e0 commit d8df308
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ published ]

jobs:
build:
Expand Down Expand Up @@ -160,6 +162,12 @@ jobs:
export OUTPUT_BASE="${WORKSPACE}"
export OUTPUT_DIR="output"
# Rename output directory to tag name if release build
if [ "${{ github.event_name }}" == "release" ]; then
mv ${OUTPUT_BASE}/${OUTPUT_DIR} ${OUTPUT_BASE}/${{ github.event.release.tag_name }}
export OUTPUT_DIR="${{ github.event.release.tag_name }}"
fi
# Create archive
if [ "${{ matrix.host.archive }}" == "tar.gz" ]; then
${TAR} -zcvf qemu_${{ matrix.host.name }}.tar.gz --owner=0 --group=0 \
Expand All @@ -172,7 +180,20 @@ jobs:
# Upload build artifact
- name: Upload build artifact
if: github.event_name != 'release'
uses: actions/upload-artifact@v2
with:
name: qemu_${{ matrix.host.name }}
path: qemu_${{ matrix.host.name }}.${{ matrix.host.archive }}

# Upload release asset
- name: Upload release asset
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: qemu_${{ matrix.host.name }}.${{ matrix.host.archive }}
asset_name: ${{ github.event.release.tag_name }}_${{ matrix.host.name }}.${{ matrix.host.archive }}
asset_content_type: application/octet-stream

0 comments on commit d8df308

Please sign in to comment.