From 2898a762d4713c1ed05db34ad06679dd1c5f0659 Mon Sep 17 00:00:00 2001 From: "Robin C. Ladiges" Date: Sat, 13 Aug 2022 21:17:11 +0200 Subject: [PATCH] attach dev builds all into one release Requirements: - there exists a tag named `latest-dev` already - there exists a release on that tag --- .github/actions/build/action.yml | 6 ++- .github/workflows/build.yml | 2 + .github/workflows/dev-release.yml | 62 +++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/dev-release.yml diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 9adf5e3..0790503 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -6,6 +6,10 @@ inputs: description : 'version tag' required : false default : '' + prefix: + description : 'filename prefix' + required : false + default : '' outputs: @@ -24,7 +28,7 @@ runs: run: | VERS=${{ inputs.tag }} echo "::set-output name=version::${VERS:1}" - echo "::set-output name=filename::SMO_Online${{ (inputs.tag != '' && format('_{0}', inputs.tag)) || '' }}" + echo "::set-output name=filename::${{ inputs.prefix }}SMO_Online${{ (inputs.tag != '' && format('_{0}', inputs.tag)) || '' }}" - name : Set up Docker Buildx uses : docker/setup-buildx-action@v2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 175a8f7..893e378 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,11 +5,13 @@ on: push: branches: - '**' + - '!dev' tags: - '**' - '!v[0-9]+.[0-9]+.[0-9]+' - '!v[0-9]+.[0-9]+.[0-9]+\+*' - '!v[0-9]+.[0-9]+.[0-9]+-*' + - '!latest-dev' pull_request: branches: - '**' diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml new file mode 100644 index 0000000..386dcb7 --- /dev/null +++ b/.github/workflows/dev-release.yml @@ -0,0 +1,62 @@ +name: Dev Release + + +on: + push: + branches: + - 'dev' + + +env: + TAG : 'latest-dev' + + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + + +jobs: + + build: + runs-on: ubuntu-latest + outputs: + filename: ${{ steps.build.outputs.filename }} + steps: + - + name : Checkout + uses : actions/checkout@v3 + - + name : Environment + id : env + shell : bash + run: | + echo "::set-output name=prefix::$(date +'%Y%m%d_%H%M%S_' --utc)" + - + name : Build artifacts + id : build + uses : ./.github/actions/build + with: + prefix : ${{ steps.env.outputs.prefix }} + + attach: + needs: build + runs-on: ubuntu-latest + steps: + - + name : Checkout + uses : actions/checkout@v3 + - + name : Get release info + id : release + shell : bash + run: | + url=`curl -sS --fail ${{ github.api_url }}/repos/${{ github.repository }}/releases/tags/${{ env.TAG }} | jq .upload_url -r` + echo "::set-output name=upload_url::$url" + - + name : Attach build artifacts to release + uses : ./.github/actions/attach + with: + filename : ${{ needs.build.outputs.filename }} + upload_url : ${{ steps.release.outputs.upload_url }} + GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}