-
Notifications
You must be signed in to change notification settings - Fork 1
release: 0.6.0 #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release: 0.6.0 #19
Changes from all commits
241ec96
420f278
2fb6855
f8c18cf
6af4982
01a3fd1
05b09aa
c8b6ee3
b30b33b
fd74279
c46e332
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,12 @@ | ||
| name: Promote SDKs | ||
| name: Promote SDK changes | ||
|
|
||
| # Manually fast-forwards production main to the reviewed staging main. The | ||
| # ancestor check refuses divergent histories; this workflow never force-pushes. | ||
| # Staging is the generator's integration history. Production `next` is the | ||
| # developer-facing queue for the next release. This workflow combines the | ||
| # latest released state with validated staging changes, then advances `next`. | ||
| # Release automation maintains the single versioned PR from `next` to `main`. | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| workflow_dispatch: {} | ||
|
|
||
| permissions: | ||
|
|
@@ -12,7 +16,9 @@ jobs: | |
| promote: | ||
| if: github.repository == 'kernel/hypeman-ts-staging' | ||
| runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} | ||
| environment: production | ||
| concurrency: | ||
| group: stlc-promote | ||
| cancel-in-progress: true | ||
| steps: | ||
| - name: Check out staging | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
@@ -29,33 +35,99 @@ jobs: | |
| owner: kernel | ||
| repositories: hypeman-ts | ||
| permission-contents: write | ||
| permission-pull-requests: write | ||
| permission-workflows: write | ||
|
|
||
| - name: Fetch production main | ||
| - name: Fetch production branches | ||
| id: production | ||
| env: | ||
| GH_TOKEN: ${{ steps.production-token.outputs.token }} | ||
| PRODUCTION_REPO: kernel/hypeman-ts | ||
| run: | | ||
| git remote add production "https://x-access-token:${GH_TOKEN}@github.com/${PRODUCTION_REPO}.git" | ||
| set -euo pipefail | ||
| git remote add production \ | ||
| "https://x-access-token:${GH_TOKEN}@github.com/${PRODUCTION_REPO}.git" | ||
| git fetch production main | ||
|
|
||
| - name: Check whether production already has staging's content | ||
| id: diff | ||
| run: | | ||
| MERGED=$(git merge-tree --write-tree production/main origin/main) || MERGED=conflict | ||
| PRODUCTION_TREE=$(git rev-parse 'production/main^{tree}') | ||
| if [ "$MERGED" = "$PRODUCTION_TREE" ]; then | ||
| echo "Production already contains staging's content. Nothing to promote." | ||
| echo "synced=true" >> "$GITHUB_OUTPUT" | ||
| if git ls-remote --exit-code --heads production next >/dev/null 2>&1; then | ||
| git fetch production next | ||
| echo "has_next=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "synced=false" >> "$GITHUB_OUTPUT" | ||
| echo "has_next=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Promote staging to production | ||
| if: steps.diff.outputs.synced == 'false' | ||
| - name: Prepare the next release branch | ||
| env: | ||
| APP_SLUG: ${{ steps.production-token.outputs.app-slug }} | ||
| GH_TOKEN: ${{ steps.production-token.outputs.token }} | ||
| HAS_NEXT: ${{ steps.production.outputs.has_next }} | ||
| PRODUCTION_REPO: kernel/hypeman-ts | ||
| run: | | ||
| if ! git merge-base --is-ancestor production/main origin/main; then | ||
| echo "::error title=Promote blocked::production/main is not an ancestor of staging main. Back-sync production first." | ||
| set -euo pipefail | ||
| bot_id=$(gh api "/users/${APP_SLUG}[bot]" --jq .id) | ||
| git config user.name "${APP_SLUG}[bot]" | ||
| git config user.email "${bot_id}+${APP_SLUG}[bot]@users.noreply.github.com" | ||
|
|
||
| open_conflict_pr() { | ||
| source_ref=$1 | ||
| source_name=$2 | ||
| advance_next=$3 | ||
| conflict_branch=stlc/promotion-conflict | ||
|
|
||
| git merge --abort | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Conflict abort assumes active mergeLow Severity
Additional Locations (1)Reviewed by Cursor Bugbot for commit 573786c. Configure here. |
||
| existing=$(gh pr list --repo "$PRODUCTION_REPO" --base next \ | ||
| --head "$conflict_branch" --state open --json url --jq '.[0].url // ""') | ||
| if [ -n "$existing" ]; then | ||
| echo "::error title=SDK promotion blocked::Resolve the existing recovery PR: $existing" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "$advance_next" = "true" ]; then | ||
| git push production HEAD:refs/heads/next | ||
| fi | ||
| git push production "$source_ref:refs/heads/$conflict_branch" --force | ||
|
|
||
| body=$(mktemp) | ||
| printf '%s\n' \ | ||
| '## SDK promotion conflict' \ | ||
| '' \ | ||
| "The automated promotion could not merge $source_name into the pending next release." \ | ||
| '' \ | ||
| 'Resolve the conflicts on this branch, validate the SDK, mark this PR ready, and merge it with a merge commit.' \ | ||
| '' \ | ||
| 'After merging, rerun the staging Promote SDK changes workflow to include any newer generated changes.' \ | ||
| > "$body" | ||
| recovery_url=$(gh pr create --repo "$PRODUCTION_REPO" --draft \ | ||
| --base next --head "$conflict_branch" \ | ||
| --title 'chore: resolve SDK promotion conflict' --body-file "$body") | ||
| echo "::error title=SDK promotion conflict::Resolve the recovery PR: $recovery_url" | ||
| exit 1 | ||
| } | ||
|
|
||
| if [ "$HAS_NEXT" = "true" ]; then | ||
| git checkout -B stlc/promote-next production/next | ||
| else | ||
| git checkout -B stlc/promote-next production/main | ||
| fi | ||
|
|
||
| if ! git merge-base --is-ancestor production/main HEAD; then | ||
| if ! git merge --no-edit production/main; then | ||
| open_conflict_pr production/main 'production main' false | ||
| fi | ||
| fi | ||
| if ! git merge-base --is-ancestor origin/main HEAD; then | ||
| if ! git merge --no-edit origin/main; then | ||
| open_conflict_pr origin/main 'validated staging changes' true | ||
| fi | ||
| fi | ||
|
|
||
| if [ "$HAS_NEXT" = "true" ]; then | ||
| git merge-base --is-ancestor production/next HEAD | ||
| fi | ||
| git push production origin/main:refs/heads/main | ||
|
|
||
| - name: Update the pending release | ||
| env: | ||
| GH_TOKEN: ${{ steps.production-token.outputs.token }} | ||
| run: | | ||
| set -euo pipefail | ||
| git push production HEAD:refs/heads/next | ||
| echo "Updated production next; the versioned release PR will be opened or refreshed." | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| { | ||
| ".": "0.5.1" | ||
| ".": "0.6.0" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| configured_endpoints: 58 | ||
| configured_endpoints: 61 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promote cancel race breaks push
Medium Severity
cancel-in-progress: trueonstlc-promotecan cancel a run whose push tonextstill lands, while the newer run already fetched the old tip and later built a different merge commit. The finalgit pushtonextthen fails as a non-fast-forward, so validated staging changes stay offnextuntil someone reruns the workflow.Additional Locations (1)
.github/workflows/stlc-promote.yml#L126-L133Reviewed by Cursor Bugbot for commit c46e332. Configure here.