Skip to content

Commit c44efc8

Browse files
author
root
committed
chore(ci): revamp release flow and remove legacy hook bridge
1 parent cf9180f commit c44efc8

30 files changed

Lines changed: 1197 additions & 676 deletions

.changeset/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changesets
2+
3+
This repository uses Changesets to maintain the CLI release PR and changelog.
4+
5+
Current policy:
6+
7+
- Normal PRs may omit a changeset.
8+
- If a PR should be released, add a changeset for `@spencer-kit/coder-studio`.
9+
- Internal workspace changes that affect the CLI should still be described under the CLI package.
10+
- Non-CLI packages are currently internal-only and must not be targeted by changesets.

.changeset/config.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{
6+
"repo": "spencerkit/coder-studio"
7+
}
8+
],
9+
"commit": false,
10+
"fixed": [],
11+
"linked": [],
12+
"access": "public",
13+
"baseBranch": "main",
14+
"updateInternalDependencies": "patch",
15+
"ignore": []
16+
}

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ci-${{ github.event_name }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
verify:
15+
name: Lint, test, and build
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: "24"
28+
cache: "pnpm"
29+
30+
- name: Enable pnpm
31+
run: corepack enable
32+
33+
- name: Install dependencies
34+
run: pnpm install --frozen-lockfile
35+
36+
- name: Validate changesets metadata
37+
run: pnpm changeset:validate
38+
39+
- name: Run lint
40+
run: pnpm ci:lint
41+
42+
- name: Run tests
43+
run: pnpm ci:test
44+
45+
- name: Run production build
46+
run: pnpm ci:build

.github/workflows/publish.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Publish CLI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
npm_tag:
7+
description: "npm dist-tag to publish under"
8+
required: true
9+
default: "latest"
10+
type: string
11+
12+
concurrency:
13+
group: publish-cli
14+
cancel-in-progress: false
15+
16+
jobs:
17+
publish:
18+
name: Publish CLI package
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Ensure publish runs from main
30+
run: |
31+
if [ "${GITHUB_REF_NAME}" != "main" ]; then
32+
echo "Publish workflow must run from main" >&2
33+
exit 1
34+
fi
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: "24"
40+
cache: "pnpm"
41+
registry-url: "https://registry.npmjs.org"
42+
43+
- name: Enable pnpm
44+
run: corepack enable
45+
46+
- name: Install dependencies
47+
run: pnpm install --frozen-lockfile
48+
49+
- name: Ensure there are no pending release changesets
50+
run: |
51+
pending_changesets=$(find .changeset -maxdepth 1 -type f -name '*.md' ! -name 'README.md')
52+
if [ -n "${pending_changesets}" ]; then
53+
echo "Pending changesets exist. Merge the generated release PR before publishing." >&2
54+
echo "${pending_changesets}" >&2
55+
exit 1
56+
fi
57+
58+
- name: Run release validation
59+
run: pnpm ci:release:validate
60+
61+
- name: Read CLI version
62+
id: release
63+
run: |
64+
version=$(node --input-type=module -e "import { readFileSync } from 'node:fs'; console.log(JSON.parse(readFileSync('packages/cli/package.json', 'utf8')).version)")
65+
if [ -z "${version}" ]; then
66+
echo "Failed to determine CLI version" >&2
67+
exit 1
68+
fi
69+
echo "version=${version}" >> "${GITHUB_OUTPUT}"
70+
echo "tag=v${version}" >> "${GITHUB_OUTPUT}"
71+
72+
- name: Ensure release tag does not already exist
73+
run: |
74+
if git rev-parse --verify --quiet "refs/tags/${{ steps.release.outputs.tag }}" >/dev/null; then
75+
echo "Release tag ${{ steps.release.outputs.tag }} already exists" >&2
76+
exit 1
77+
fi
78+
79+
- name: Publish CLI to npm
80+
env:
81+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
82+
run: |
83+
if [ -z "${NODE_AUTH_TOKEN}" ]; then
84+
echo "NPM_TOKEN secret is required for publishing" >&2
85+
exit 1
86+
fi
87+
pnpm publish:cli -- --publish --no-build --tag "${{ inputs.npm_tag }}"
88+
89+
- name: Create and push release tag
90+
run: |
91+
git config user.name "github-actions[bot]"
92+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
93+
git tag "${{ steps.release.outputs.tag }}"
94+
git push origin "${{ steps.release.outputs.tag }}"
95+
96+
- name: Create GitHub release
97+
env:
98+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
run: |
100+
gh release create "${{ steps.release.outputs.tag }}" \
101+
--title "@spencer-kit/coder-studio ${{ steps.release.outputs.version }}" \
102+
--generate-notes \
103+
--verify-tag
104+

.github/workflows/quality.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/workflows/release-pr.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release PR
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: release-pr-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
release-pr:
14+
name: Create or update release PR
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: "24"
30+
cache: "pnpm"
31+
32+
- name: Enable pnpm
33+
run: corepack enable
34+
35+
- name: Install dependencies
36+
run: pnpm install --frozen-lockfile
37+
38+
- name: Validate changesets metadata
39+
run: pnpm changeset:validate
40+
41+
- name: Create or update release PR
42+
uses: changesets/action@v1
43+
with:
44+
version: pnpm version-packages
45+
commit: "release: version packages"
46+
title: "release: version packages"
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+

.github/workflows/release.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ pnpm dev
126126
### Common Commands
127127

128128
```bash
129+
pnpm changeset
129130
pnpm acceptance:phase1
130131
pnpm build:cli
131132
pnpm lint
@@ -134,6 +135,14 @@ pnpm format
134135
pnpm check
135136
```
136137

138+
### Release Flow
139+
140+
- Release-worthy PRs add a changeset for `@spencer-kit/coder-studio`
141+
- Ordinary PRs can merge without a changeset
142+
- After release-worthy changes land on `main`, GitHub Actions auto-creates or updates a release PR
143+
- Merging the release PR writes the CLI version bump and changelog
144+
- Publishing is manual through the `Publish CLI` workflow, which publishes to npm, creates the git tag, and opens the GitHub release
145+
137146
### Tech Stack
138147

139148
- Frontend: React + Vite + Jotai

0 commit comments

Comments
 (0)