Skip to content

Commit

Permalink
Merge pull request #35 from KIT-MRT/fix_version_bump_workflow
Browse files Browse the repository at this point in the history
Split compute-version and update-version-file into separate jobs to fix release pipeline. #major
  • Loading branch information
ll-nick authored Nov 12, 2024
2 parents 966334f + 7d33c7a commit 892831a
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 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 @@ -27,7 +25,7 @@ jobs:
echo "Current version: $INITIAL_VERSION"
echo "INITIAL_VERSION=${INITIAL_VERSION}" >> $GITHUB_ENV
- name: Bump version and push tag
- name: Bump version
id: bump_version
uses: anothrNick/github-tag-action@v1
env:
Expand All @@ -37,50 +35,64 @@ jobs:
INITIAL_VERSION: ${{ env.INITIAL_VERSION }}
WITH_V: true


update-version-file:
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
steps:
- 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
with:
context: .
push: false
tags: |
util_caching_release
release_builder
target: release

- name: Copy release packages
run: |
mkdir -p /tmp/artifacts/
docker run --rm -v /tmp/artifacts:/tmp/artifacts util_caching_release cp -r /release /tmp/artifacts/
docker run --rm -v /tmp/artifacts:/tmp/artifacts release_builder cp -r /release /tmp/artifacts/
- name: Create Release
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 892831a

Please sign in to comment.