-
Notifications
You must be signed in to change notification settings - Fork 51
ci(release): move to scheduled weekly releases with relnotes tooling #756
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 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7c05d9b
ci(release): move to scheduled releases with dry-run validation
92c2e51
ci(release): add conventionalcommits preset and clean up scripts
b93ae2f
ci(release): add relnotes tool and conventionalcommits config
cpcloud 37a4cbc
ci(release): fix dry-run and add CI status gate
cpcloud a4e8b39
ci(release): set git identity for dry-run worktree commit
cpcloud 474c1e0
ci(release): address review feedback
cpcloud 4591393
ci(release): verify all required checks before releasing
cpcloud acaaac6
ci(release): fetch required checks from branch ruleset API
cpcloud b8aa5c8
ci(release): single API call for check-run verification
cpcloud 28ada46
ci(release): use github.sha instead of git rev-parse HEAD
cpcloud b782828
ci(release): use halt_error for empty required checks guard
cpcloud 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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,27 @@ | ||
| // Copyright 2026 Phillip Cloud | ||
| // Licensed under the Apache License, Version 2.0 | ||
|
|
||
|
|
||
|
|
||
| const { readFileSync } = require("node:fs"); | ||
|
|
||
| const releaseConfig = JSON.parse(readFileSync("./.releaserc.json", "utf8")); | ||
|
|
||
| const types = releaseConfig.plugins | ||
| .filter((p) => Array.isArray(p) && p[0] === "@semantic-release/release-notes-generator") | ||
| .map((p) => p[1].presetConfig.types)[0]; | ||
|
|
||
| module.exports = { | ||
| options: { | ||
| preset: { | ||
| name: "conventionalcommits", | ||
| types, | ||
| }, | ||
| }, | ||
| writerOpts: { | ||
| finalizeContext(ctx) { | ||
| ctx.linkCompare = false; | ||
| return ctx; | ||
| }, | ||
| }, | ||
| }; | ||
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,71 @@ | ||
| # Copyright 2026 Phillip Cloud | ||
| # Licensed under the Apache License, Version 2.0 | ||
|
|
||
| name: Scheduled Release | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "0 14 * * 0" # Sundays at 2pm UTC | ||
| workflow_dispatch: {} | ||
|
|
||
| concurrency: | ||
| group: scheduled-release | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
|
cpcloud marked this conversation as resolved.
|
||
| jobs: | ||
| semantic-release: | ||
| name: Semantic Release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| checks: read | ||
| contents: write | ||
| steps: | ||
| - name: Generate app token | ||
| id: app-token | ||
| uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 | ||
| with: | ||
| app-id: ${{ secrets.APP_ID }} | ||
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | ||
|
|
||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ steps.app-token.outputs.token }} | ||
|
|
||
| - name: Verify HEAD passed required checks | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: | | ||
| sha=$(git rev-parse HEAD) | ||
|
|
||
| # Fetch required check names from the branch ruleset | ||
| mapfile -t checks < <( | ||
| gh api "repos/${{ github.repository }}/rules/branches/main" \ | ||
| --jq '[.[] | select(.type == "required_status_checks") | .parameters.required_status_checks[].context] | .[]' | ||
| ) | ||
|
|
||
| if [ ${#checks[@]} -eq 0 ]; then | ||
| echo "::error::No required status checks found for main. Aborting release." | ||
| exit 1 | ||
| fi | ||
|
|
||
| for check_name in "${checks[@]}"; do | ||
| conclusion=$(gh api "repos/${{ github.repository }}/commits/$sha/check-runs" \ | ||
| --jq "[.check_runs[] | select(.name == \"$check_name\")] | sort_by(.completed_at) | last | .conclusion") | ||
| if [ "$conclusion" != "success" ]; then | ||
| echo "::error::HEAD ($sha) $check_name is '${conclusion:-none}', expected 'success'. Aborting release." | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | ||
| with: | ||
| node-version: lts/* | ||
|
|
||
|
cpcloud marked this conversation as resolved.
|
||
| - name: Run semantic-release | ||
| run: bash ci/release/run.bash | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
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
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,54 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright 2026 Phillip Cloud | ||
| # Licensed under the Apache License, Version 2.0 | ||
| # | ||
| # Simulate a semantic-release run in a disposable worktree. | ||
| # Strips @semantic-release/github to avoid any GitHub API calls. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| curdir="$PWD" | ||
| worktree="$(mktemp -d)" | ||
| branch="semantic-release-dry-run-$(basename "$worktree")" | ||
|
|
||
| git worktree add -b "$branch" "$worktree" HEAD | ||
|
|
||
| cleanup() { | ||
| cd "$curdir" | ||
| git worktree remove --force "$worktree" | ||
| git worktree prune | ||
| if git show-ref --verify --quiet "refs/heads/$branch"; then | ||
| git branch -D "$branch" | ||
| fi | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| cd "$worktree" | ||
|
|
||
| # Strip @semantic-release/github so the dry-run makes no API calls | ||
| tmp=$(mktemp) | ||
| jq '.plugins |= map(select( | ||
| if type == "array" then .[0] != "@semantic-release/github" | ||
| else . != "@semantic-release/github" | ||
| end | ||
| ))' .releaserc.json > "$tmp" | ||
| mv "$tmp" .releaserc.json | ||
|
cpcloud marked this conversation as resolved.
|
||
|
|
||
| git add .releaserc.json | ||
| git -c user.email=ci@localhost -c user.name=CI \ | ||
| commit -m "test: semantic-release dry run" --no-verify --no-gpg-sign | ||
|
|
||
| # Unset so semantic-release exercises the full pipeline instead of | ||
| # short-circuiting on PR detection | ||
| unset GITHUB_ACTIONS | ||
|
|
||
| npx --yes \ | ||
| -p "semantic-release@25.0.3" \ | ||
| -p "@semantic-release/exec@7.1.0" \ | ||
| -p "@semantic-release/git@10.0.1" \ | ||
| -p "conventional-changelog-conventionalcommits@8.0.0" \ | ||
| semantic-release \ | ||
| --ci \ | ||
| --dry-run \ | ||
| --branches "$branch" \ | ||
| --repository-url "file://$PWD" | ||
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,14 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright 2026 Phillip Cloud | ||
| # Licensed under the Apache License, Version 2.0 | ||
| # | ||
| # Run semantic-release to publish a new release. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| npx --yes \ | ||
| -p "semantic-release@25.0.3" \ | ||
| -p "@semantic-release/exec@7.1.0" \ | ||
| -p "@semantic-release/git@10.0.1" \ | ||
| -p "conventional-changelog-conventionalcommits@8.0.0" \ | ||
| semantic-release --ci |
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
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.