chore: automate version prefix bump and PR creation in release workflow

This commit is contained in:
Nawaz Dhandala
2025-11-27 11:29:30 +00:00
parent 847bac5c6a
commit 0fd3121b29

View File

@@ -65,6 +65,7 @@ jobs:
target_patch="$patch"
updated="false"
pr_url=""
latest_tag="$(gh release view --repo "$REPOSITORY" --json tagName --jq '.tagName' 2>/dev/null || echo "")"
if [[ -n "$latest_tag" ]]; then
@@ -87,8 +88,14 @@ jobs:
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add VERSION_PREFIX
if ! git diff --cached --quiet; then
branch_name="chore/bump-version-prefix-${new_version}-$(date +%s)"
git checkout -b "$branch_name"
git commit -m "chore: bump version prefix to ${new_version} [skip ci]"
git push
git push origin "$branch_name"
pr_title="chore: bump version prefix to ${new_version}"
pr_body=$'Automated change to VERSION_PREFIX to align release workflow with master.\n\nCreated by GitHub Actions release workflow.'
gh pr create --repo "$REPOSITORY" --base master --head "$branch_name" --title "$pr_title" --body "$pr_body"
pr_url="$(gh pr view "$branch_name" --repo "$REPOSITORY" --json url --jq '.url' 2>/dev/null || true)"
updated="true"
fi
fi
@@ -98,6 +105,7 @@ jobs:
echo "minor=${minor}" >> "$GITHUB_OUTPUT"
echo "patch=${target_patch}" >> "$GITHUB_OUTPUT"
echo "updated=${updated}" >> "$GITHUB_OUTPUT"
echo "pr_url=${pr_url}" >> "$GITHUB_OUTPUT"
echo "Using version base: ${new_version}"