-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Implement changelog-driven release workflow #6822
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7938829
Overhaul release process: CHANGELOG.md as the source of truth
claude 5644908
Harden release pipeline: human-approved uploads, lockstep + ordering,…
claude 13b362d
Fix approval-gate token scope and stale flow documentation
claude f978d78
Enforce the script lockfile, parser-shared heading guard, artifact ch…
claude a0dcde8
Auto-select packages with pending news fragments in Dispatch release
claude 0aa6d38
Fix unmatched news pathspec failing prerelease/release delivery
claude b819190
verify-dist: ignore hidden files, matching what uv publish uploads
claude cdee059
Stamp changelog dates in the release timezone, not runner UTC
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| : "${GH_TOKEN:?}" | ||
| : "${ACTION:?}" | ||
| : "${REF_NAME:?}" | ||
| : "${RELEASES:?}" | ||
| : "${GITHUB_RUN_ID:?}" | ||
|
|
||
| # Final versions publish from main — except hotfix trains, which publish | ||
| # directly from their r/hotfix/** branch, so the PR targets it instead. | ||
| BASE="main" | ||
| if [[ "$REF_NAME" == r/hotfix/* ]]; then | ||
| BASE="$REF_NAME" | ||
| fi | ||
|
|
||
| BRANCH="release/${ACTION}-${GITHUB_RUN_ID}" | ||
| SUMMARY=$(echo "$RELEASES" | jq -r '[.[] | "\(.package)@\(.next)"] | join(", ")') | ||
|
|
||
| BODY_FILE="${RUNNER_TEMP}/release_pr_body.md" | ||
| { | ||
| echo "Materialized changelogs for release action \`${ACTION}\` (dispatched on \`${REF_NAME}\`)." | ||
| echo "" | ||
| echo "| Package | Current | Next | Tag |" | ||
| echo "|---------|---------|------|-----|" | ||
| echo "$RELEASES" | jq -r '.[] | "| `\(.package)` | `\(if .current == "" then "<none>" else .current end)` | `\(.next)` | `\(.tag)` |"' | ||
| echo "" | ||
| echo "Merging this PR lands the versions above for release: the push to \`${BASE}\`" | ||
| echo "triggers the \`release_from_changelog\` workflow, which builds each package and" | ||
| echo "then waits for \`pypi\` environment approval before uploading; the tag and" | ||
| echo "GitHub release are created only after a successful upload. If a publish" | ||
| echo "fails, fix the problem on top of the changelog bump — the next push retries" | ||
| echo "automatically." | ||
| } > "$BODY_FILE" | ||
|
|
||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| # Stage the changelog rewrites (including first-release creations); a | ||
| # directory pathspec with a wildcard never matches, so name the files. The | ||
| # consumed news fragments are already staged by towncrier's git rm, and | ||
| # `commit -a` below picks up any tracked change it left unstaged — while | ||
| # never committing untracked stray files. | ||
| git add -- CHANGELOG.md 'packages/*/CHANGELOG.md' | ||
| if git diff --cached --quiet && git diff --quiet; then | ||
| echo "Error: materialization produced no changes; nothing to release." | ||
| exit 1 | ||
| fi | ||
| git commit -a -m "Materialize changelogs for ${SUMMARY} (${ACTION})" | ||
|
masenf marked this conversation as resolved.
|
||
| # The token is supplied via gh's credential helper so it never appears in a | ||
| # remote URL or process argv. | ||
| git -c credential.helper= -c 'credential.helper=!gh auth git-credential' \ | ||
| push origin "HEAD:refs/heads/${BRANCH}" | ||
|
|
||
| PR_URL=$(gh pr create --base "$BASE" --head "$BRANCH" --title "Release ${SUMMARY}" --body-file "$BODY_FILE") | ||
|
|
||
| # The PR only rewrites changelogs and deletes consumed news fragments, so the | ||
| # changelog fragment check does not apply. Label failure is non-fatal. | ||
| gh pr edit "$PR_URL" --add-label skip-changelog || echo "::notice::could not add skip-changelog label to $PR_URL" | ||
|
|
||
| { | ||
| echo "## Release PR opened" | ||
| echo "" | ||
| echo "$PR_URL" | ||
| echo "" | ||
| echo "Releases: ${SUMMARY}" | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.