Refactor branch handling in publish_release.yml

Updated the workflow to handle branch deletion and creation more gracefully.
This commit is contained in:
Michel Roegl-Brunner
2025-10-07 10:51:41 +02:00
committed by GitHub
parent b96b5493f3
commit 6a7a1f94f9

View File

@@ -35,13 +35,15 @@ jobs:
- name: Create branch and commit VERSION - name: Create branch and commit VERSION
run: | run: |
branch="update-version-${{ steps.draft.outputs.tag_name }}" branch="update-version-${{ steps.draft.outputs.tag_name }}"
git checkout -b "$branch" git push origin --delete "$branch" || echo "No remote branch to delete"
git fetch origin main
git checkout -b "$branch" origin/main
echo "${{ steps.draft.outputs.tag_name }}" | sed 's/^v//' > VERSION echo "${{ steps.draft.outputs.tag_name }}" | sed 's/^v//' > VERSION
git add VERSION git add VERSION
git config user.name "github-actions[bot]" git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com" git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "chore: add VERSION ${{ steps.draft.outputs.tag_name }}" || echo "No changes to commit" git commit -m "chore: add VERSION ${{ steps.draft.outputs.tag_name }}"
git push --set-upstream origin "$branch" --force git push --set-upstream origin "$branch"
- name: Create pull request - name: Create pull request