Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,15 @@ jobs:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json

# Enable native auto-merge and stop; GitHub rebase-merges once the required
# checks pass, and that PAT-authored merge re-triggers this workflow to cut
# the tag/release.
- if: ${{ steps.release.outputs.pr }}
env:
GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
REPO: ${{ github.repository }}
WORKFLOW: ${{ github.workflow }}
PR_JSON: ${{ steps.release.outputs.pr }}
run: |
PR=$(echo "$PR_JSON" | jq -r .number)
BRANCH=$(echo "$PR_JSON" | jq -r .headBranchName)
# Rebase-merge works when main has advanced past the release branch's
# base. When the release commit already sits directly on main HEAD,
# GitHub refuses ("This branch can't be rebased") on a rebase-only
# repo — fast-forward main to the release commit via the API instead.
gh pr merge --rebase --auto -R "$REPO" "$PR" \
|| gh pr merge --rebase -R "$REPO" "$PR" \
|| gh api -X PATCH "repos/$REPO/git/refs/heads/main" \
-f sha="$(gh api "repos/$REPO/git/refs/heads/$BRANCH" --jq .object.sha)"
for _ in $(seq 1 30); do
STATE=$(gh pr view "$PR" -R "$REPO" --json state --jq .state)
[ "$STATE" = "MERGED" ] && break
sleep 2
done
gh api -X DELETE "repos/$REPO/git/refs/heads/$BRANCH" 2>/dev/null || true
gh workflow run "$WORKFLOW" -R "$REPO" --ref main
run: gh pr merge --rebase --auto -R "$REPO" "$(echo "$PR_JSON" | jq -r .number)"

# When a release is actually published, redeploy from main so the live
# build carries the bumped version. release-please's own version-bump
Expand Down