diff --git a/.github/workflows/bump-version-and-create-release.yaml b/.github/workflows/bump-version-and-create-release.yaml index a707320..92969e6 100644 --- a/.github/workflows/bump-version-and-create-release.yaml +++ b/.github/workflows/bump-version-and-create-release.yaml @@ -7,7 +7,7 @@ on: - main jobs: - bump-version: + compute-version: if: github.event.pull_request.merged == true runs-on: ubuntu-latest permissions: @@ -17,8 +17,6 @@ jobs: steps: - name: Check out the repository uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.DEPLOY_KEY }} - name: Read version from file run: | @@ -37,23 +35,37 @@ jobs: INITIAL_VERSION: ${{ env.INITIAL_VERSION }} WITH_V: true + + update-version-file: + if: github.event.pull_request.merged == true + needs: compute-version + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Check out the repository + uses: actions/checkout@v4 + with: + ssh-key: ${{ secrets.DEPLOY_KEY }} + - name: Update version file with new version run: | - echo "New version: ${{ steps.bump_version.outputs.new_tag }}" - echo "VERSION=${{ steps.bump_version.outputs.new_tag }}" > version + echo "New version: ${{ needs.compute-version.outputs.new_tag }}" + echo "VERSION=${{ needs.compute-version.outputs.new_tag }}" > version git config --local user.name "github-actions[bot]" git config --local user.email "github-actions[bot]@users.noreply.github.com" git add version - git commit -m "chore: update version file to ${{ steps.bump_version.outputs.new_tag }}" + git commit -m "chore: update version file to ${{ needs.compute-version.outputs.new_tag }}" git push - name: Push new tag run: | - git tag ${{ steps.bump_version.outputs.new_tag }} - git push origin ${{ steps.bump_version.outputs.new_tag }} + git tag ${{ needs.compute-version.outputs.new_tag }} + git push origin ${{ needs.compute-version.outputs.new_tag }} + create-release: - needs: bump-version + needs: [compute-version, update-version-file] runs-on: ubuntu-latest permissions: contents: write @@ -61,7 +73,8 @@ jobs: - name: Check out the repository and pull the new tag uses: actions/checkout@v4 with: - ref: ${{ needs.bump-version.outputs.new_tag }} + fetch-depth: 0 + ref: ${{ needs.compute-version.outputs.new_tag }} - name: Build release packages uses: docker/build-push-action@v6 @@ -81,6 +94,6 @@ jobs: uses: ncipollo/release-action@v1 with: artifacts: "/tmp/artifacts/release/*" - tag: ${{ needs.bump-version.outputs.new_tag }} + tag: ${{ needs.compute-version.outputs.new_tag }} body: ${{ github.event.pull_request.body }}