Skip to content

Commit a3b4021

Browse files
fix(ci): handle branch protection in release workflow
The publish-crates job failed pushing the version bump commit to main because GITHUB_TOKEN cannot bypass required status checks. Now attempts the push first, and falls back to creating a PR if blocked. Also bumps version to 0.4.11 for next development cycle (the 26.02_4 release workflow couldn't complete this step).
1 parent 694cc2c commit a3b4021

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,26 @@ jobs:
224224
git add Cargo.toml crates/*/Cargo.toml
225225
git commit -m "chore: bump version to ${{ needs.validate.outputs.new-semver }} for release ${{ needs.validate.outputs.calver }}"
226226
227-
# Push to main branch
228-
git push origin HEAD:main
229-
230227
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
231228
229+
- name: Push version bump to main
230+
id: push
231+
continue-on-error: true
232+
run: git push origin HEAD:main
233+
234+
- name: Create PR for version bump if push was blocked
235+
if: steps.push.outcome == 'failure'
236+
env:
237+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
238+
run: |
239+
BRANCH="chore/bump-${{ needs.validate.outputs.new-semver }}"
240+
git checkout -b "$BRANCH"
241+
git push origin "$BRANCH"
242+
gh pr create \
243+
--title "chore: bump version to ${{ needs.validate.outputs.new-semver }} for release ${{ needs.validate.outputs.calver }}" \
244+
--body "Automated version bump after release ${{ needs.validate.outputs.calver }}. Direct push to main was blocked by branch protection." \
245+
--base main
246+
232247
- name: Setup Rust
233248
uses: dtolnay/rust-toolchain@stable
234249

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ exclude = [
1818
resolver = "2"
1919

2020
[workspace.package]
21-
version = "0.4.10"
21+
version = "0.4.11"
2222
edition = "2021"
2323
authors = ["Sentinel Contributors"]
2424
license = "MIT OR Apache-2.0"

0 commit comments

Comments
 (0)