From d8df308f2cab15e33594969a931ab2b5210a1723 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Tue, 26 May 2020 12:48:41 +0900 Subject: [PATCH] ci: Add release automation process 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 --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d1302eaa2..8fabfef2e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,8 @@ on: branches: [ master ] pull_request: branches: [ master ] + release: + types: [ published ] jobs: build: @@ -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 \ @@ -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