Skip to content

Commit

Permalink
Split compute-version and update-version-file into separate jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
ll-nick committed Nov 11, 2024
1 parent 966334f commit fb8c873
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions .github/workflows/bump-version-and-create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- main

jobs:
bump-version:
compute-version:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
Expand All @@ -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: |
Expand All @@ -37,31 +35,45 @@ 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: update-version-file
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out the repository and pull the new tag
uses: actions/checkout@v4
with:
ref: ${{ needs.bump-version.outputs.new_tag }}
ref: ${{ needs.compute-version.outputs.new_tag }}

- name: Build release packages
uses: docker/build-push-action@v6
Expand All @@ -81,6 +93,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 }}

0 comments on commit fb8c873

Please sign in to comment.