From 55921996d6909f763927c9cf7b297044582b894a Mon Sep 17 00:00:00 2001 From: Jan Richter Date: Fri, 15 Nov 2024 11:16:18 +0100 Subject: [PATCH] Add release workflow to release-bot This commit adds automatic release triggering after the release voting has been successful. It will run the pre-release checks and if they pass it will do the release itself. Reference: #21 Signed-off-by: Jan Richter --- .github/workflows/pre-release.yml | 5 +++-- .github/workflows/release-bot.yml | 19 +++++++++++++------ .github/workflows/release.yml | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index e5caeb5..ff93efa 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -1,6 +1,7 @@ name: Pre-Release -on: workflow_dispatch - +on: + workflow_dispatch: + workflow_call: jobs: release-test: diff --git a/.github/workflows/release-bot.yml b/.github/workflows/release-bot.yml index c664f7b..2b72811 100644 --- a/.github/workflows/release-bot.yml +++ b/.github/workflows/release-bot.yml @@ -7,6 +7,8 @@ jobs: release-vote: name: release vote runs-on: ubuntu-20.04 + outputs: + release: ${{ steps.vote_count.outputs.release }} steps: - name: Check out repository code uses: actions/checkout@v3 @@ -82,6 +84,7 @@ jobs: fi - name: Count votes if: ${{ env.TIME_FOR_VOTE == 1 }} + id: vote_count env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} run: | @@ -125,6 +128,7 @@ jobs: }' echo "It is time for release." echo 'TIME_FOR_RELEASE=1' >> $GITHUB_ENV + echo "release=1" >> "$GITHUB_OUTPUT" else echo "We don't have enought votes." fi @@ -151,9 +155,12 @@ jobs: } ' fi - - name: Release - if: ${{ env.TIME_FOR_RELEASE == 1 }} - env: - GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - run: | - echo 'RELEASE' + pre-release: + needs: release-vote + secrets: inherit + if: ${{ needs.release-vote.outputs.release == 1 }} + uses: ./.github/workflows/pre-release.yml + release: + needs: pre-release + secrets: inherit + uses: ./.github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d782fb2..3969a2c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,7 @@ on: - mayor - minor default: 'mayor' + workflow_call: jobs: