Skip to content

Commit fb8c873

Browse files
committed
Split compute-version and update-version-file into separate jobs
1 parent 966334f commit fb8c873

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

.github/workflows/bump-version-and-create-release.yaml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- main
88

99
jobs:
10-
bump-version:
10+
compute-version:
1111
if: github.event.pull_request.merged == true
1212
runs-on: ubuntu-latest
1313
permissions:
@@ -17,8 +17,6 @@ jobs:
1717
steps:
1818
- name: Check out the repository
1919
uses: actions/checkout@v4
20-
with:
21-
ssh-key: ${{ secrets.DEPLOY_KEY }}
2220

2321
- name: Read version from file
2422
run: |
@@ -37,31 +35,45 @@ jobs:
3735
INITIAL_VERSION: ${{ env.INITIAL_VERSION }}
3836
WITH_V: true
3937

38+
39+
update-version-file:
40+
if: github.event.pull_request.merged == true
41+
needs: compute-version
42+
runs-on: ubuntu-latest
43+
permissions:
44+
contents: write
45+
steps:
46+
- name: Check out the repository
47+
uses: actions/checkout@v4
48+
with:
49+
ssh-key: ${{ secrets.DEPLOY_KEY }}
50+
4051
- name: Update version file with new version
4152
run: |
42-
echo "New version: ${{ steps.bump_version.outputs.new_tag }}"
43-
echo "VERSION=${{ steps.bump_version.outputs.new_tag }}" > version
53+
echo "New version: ${{ needs.compute-version.outputs.new_tag }}"
54+
echo "VERSION=${{ needs.compute-version.outputs.new_tag }}" > version
4455
git config --local user.name "github-actions[bot]"
4556
git config --local user.email "github-actions[bot]@users.noreply.github.com"
4657
git add version
47-
git commit -m "chore: update version file to ${{ steps.bump_version.outputs.new_tag }}"
58+
git commit -m "chore: update version file to ${{ needs.compute-version.outputs.new_tag }}"
4859
git push
4960
5061
- name: Push new tag
5162
run: |
52-
git tag ${{ steps.bump_version.outputs.new_tag }}
53-
git push origin ${{ steps.bump_version.outputs.new_tag }}
63+
git tag ${{ needs.compute-version.outputs.new_tag }}
64+
git push origin ${{ needs.compute-version.outputs.new_tag }}
65+
5466
5567
create-release:
56-
needs: bump-version
68+
needs: update-version-file
5769
runs-on: ubuntu-latest
5870
permissions:
5971
contents: write
6072
steps:
6173
- name: Check out the repository and pull the new tag
6274
uses: actions/checkout@v4
6375
with:
64-
ref: ${{ needs.bump-version.outputs.new_tag }}
76+
ref: ${{ needs.compute-version.outputs.new_tag }}
6577

6678
- name: Build release packages
6779
uses: docker/build-push-action@v6
@@ -81,6 +93,6 @@ jobs:
8193
uses: ncipollo/release-action@v1
8294
with:
8395
artifacts: "/tmp/artifacts/release/*"
84-
tag: ${{ needs.bump-version.outputs.new_tag }}
96+
tag: ${{ needs.compute-version.outputs.new_tag }}
8597
body: ${{ github.event.pull_request.body }}
8698

0 commit comments

Comments
 (0)