-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Changesets release automation with version-pinned workflow refs #3
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
2 commits
Select commit
Hold shift + click to select a range
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 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,15 @@ | ||
| { | ||
| "$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json", | ||
| "changelog": "@changesets/cli/changelog", | ||
| "commit": false, | ||
| "fixed": [], | ||
| "linked": [], | ||
| "access": "restricted", | ||
| "baseBranch": "main", | ||
| "updateInternalDependencies": "patch", | ||
| "ignore": [], | ||
| "privatePackages": { | ||
| "version": true, | ||
| "tag": true | ||
| } | ||
| } |
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,18 @@ | ||
| --- | ||
| "@kethalia/workflows": major | ||
| --- | ||
|
|
||
| Initial 1.0.0 release of the org-wide reusable workflows and composite actions. | ||
|
|
||
| Stabilizes the public surface so consumer repos can pin to `@v1`: | ||
|
|
||
| - `ci-build-lint-test.yml` β install/build/lint/format/typecheck/test matrix with coverage reporting and per-tool incremental caches. | ||
| - `ci-quality.yml` β changeset gate, pnpm audit, and optional `verify-command`, `sherif-command`, `knip-command`, `madge-command` hooks. | ||
| - `ci-changeset-check.yml`, `ci-publish-validation.yml` β standalone changeset gate and pkg-pr-new preview publishing. | ||
| - `release-changesets.yml` β versioning + npm publish with `published` / `published-packages` outputs. | ||
| - `build-stack.yml`, `build-and-push.yml`, `publish-docker-ghcr.yml`, `release-docker-stack.yml` β Docker build/publish flows with buildcache. | ||
| - `retag-stack.yml`, `retag-image.yml`, `verify-ghcr-tags.yml`, `ghcr-prune.yml` β release-time GHCR promotion, preflight verification, retention. | ||
| - `helm-lint.yml`, `resolve-runner.yml` β Helm linting and dynamic runner-label resolution. | ||
| - `actions/setup-pnpm`, `actions/build-and-upload` β composite actions for pnpm bootstrap and image build/upload. | ||
|
|
||
| Internal cross-references between workflows and composite actions are now version-pinned (rewritten by `scripts/sync-workflow-refs.mjs` during `changeset version`) so a release at `vX.Y.Z` references its own actions at `@vX.Y.Z`. |
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,81 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Changesets | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| published: ${{ steps.changesets.outputs.published }} | ||
| publishedPackages: ${{ steps.changesets.outputs.publishedPackages }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 9.15.0 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: pnpm | ||
|
|
||
| - run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Changesets | ||
| id: changesets | ||
| uses: changesets/action@v1 | ||
| with: | ||
| version: pnpm run version | ||
| publish: pnpm changeset tag | ||
| title: "chore(release): version packages" | ||
| commit: "chore(release): version packages" | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| tag-major: | ||
| name: Move floating major tag | ||
| needs: release | ||
| if: needs.release.outputs.published == 'true' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Move v{major} and v{major}.{minor} tags | ||
| env: | ||
| PUBLISHED: ${{ needs.release.outputs.publishedPackages }} | ||
| SHA: ${{ github.sha }} | ||
| run: | | ||
| set -euo pipefail | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| VERSION="$(echo "$PUBLISHED" | jq -r '.[0].version')" | ||
| if [ -z "$VERSION" ] || [ "$VERSION" = "null" ]; then | ||
| echo "No version found in publishedPackages output; skipping." | ||
| exit 0 | ||
| fi | ||
| MAJOR="v${VERSION%%.*}" | ||
| REST="${VERSION#*.}" | ||
| MINOR="${MAJOR}.${REST%%.*}" | ||
| echo "Tagging $MAJOR and $MINOR at $SHA" | ||
| # Capture the current remote tag SHAs (empty if the tag does not yet exist) | ||
| # so --force-with-lease only overwrites what we expect. | ||
| MAJOR_OLD="$(git ls-remote --tags origin "refs/tags/$MAJOR" | awk '{print $1}')" | ||
| MINOR_OLD="$(git ls-remote --tags origin "refs/tags/$MINOR" | awk '{print $1}')" | ||
| git tag -f "$MAJOR" "$SHA" | ||
| git tag -f "$MINOR" "$SHA" | ||
| git push --force-with-lease="refs/tags/$MAJOR:$MAJOR_OLD" origin "refs/tags/$MAJOR" | ||
| git push --force-with-lease="refs/tags/$MINOR:$MINOR_OLD" origin "refs/tags/$MINOR" | ||
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,20 @@ | ||
| { | ||
| "name": "@kethalia/workflows", | ||
| "version": "0.1.0", | ||
| "private": true, | ||
| "description": "Org-wide reusable GitHub Actions workflows and composite actions shared across kethalia, chillwhales, and phlox-labs.", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/kethalia/workflows" | ||
| }, | ||
| "license": "MIT", | ||
| "packageManager": "pnpm@9.15.0", | ||
| "devDependencies": { | ||
| "@changesets/cli": "^2.27.10" | ||
| }, | ||
| "scripts": { | ||
| "changeset": "changeset", | ||
| "version": "changeset version && node scripts/sync-workflow-refs.mjs", | ||
| "release": "changeset tag" | ||
| } | ||
| } |
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.