Skip to content

Commit cd3e1dd

Browse files
steebchenclaude
andcommitted
ci: release CLI via semantic-release — no manual tagging
semantic-release + semantic-release-monorepo on push to main, mirroring theopenco/llmgateway: conventional commits touching the package drive the version, the tag create-clanker-support@<version> is created by the release, and publishing stays on npm OIDC trusted publishing (workflow filename unchanged so the existing trusted publisher keeps matching). Baseline tag create-clanker-support@1.0.0 marks the already-published release. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 70da656 commit cd3e1dd

7 files changed

Lines changed: 3147 additions & 41 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ jobs:
3030
working-directory: packages/create-clanker-support
3131
steps:
3232
- uses: actions/checkout@v4
33+
- uses: pnpm/action-setup@v4
3334
- uses: actions/setup-node@v4
3435
with:
3536
node-version: 22
36-
- run: npm install --no-package-lock
37+
cache: pnpm
38+
- run: pnpm install --frozen-lockfile
39+
working-directory: .
3740
- name: Offline checks
3841
run: |
39-
node index.mjs --version | grep -qx "1.0.0"
42+
# The committed version is a placeholder — semantic-release stamps the
43+
# real one at publish time — so only assert it prints a semver.
44+
node index.mjs --version | grep -Eq "^[0-9]+\.[0-9]+\.[0-9]+$"
4045
node index.mjs --help | grep -q "create-clanker-support"
4146
node index.mjs out --template bogus --yes && { echo "expected non-zero"; exit 1; } || true
4247
- name: Scaffold a real template (fetches from main)

.github/workflows/release-cli.yml

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,46 @@
1-
# Publishes create-clanker-support to npm. Trigger by pushing a tag:
2-
# create-clanker-support@1.0.0
3-
# Auth is OIDC trusted publishing (no token secret): configure a trusted
4-
# publisher on the npm package (Settings -> Trusted publisher) pointing at
1+
# Publishes create-clanker-support to npm via semantic-release on every push to
2+
# main — no manual tagging. semantic-release-monorepo analyzes conventional
3+
# commits touching packages/create-clanker-support, computes the next version,
4+
# tags create-clanker-support@<version>, creates the tag, and publishes.
5+
# Auth is npm OIDC trusted publishing (no token secret), bound on npmjs.com to
6+
# THIS filename:
57
# org: theopenco repo: clankersupport-templates
68
# workflow: release-cli.yml environment: (none)
7-
# npm can only add a trusted publisher to an EXISTING package, so the very
8-
# first publish must be done manually (`npm publish --access public` from
9-
# packages/create-clanker-support) — every release after that is OIDC.
10-
# The tag version must match packages/create-clanker-support/package.json —
11-
# asserted before publish.
9+
# Renaming this file breaks publishing until the trusted publisher on the npm
10+
# package settings is updated to match.
1211
name: Release CLI
1312

1413
on:
1514
push:
16-
tags:
17-
- "create-clanker-support@*"
15+
branches: [main]
16+
17+
permissions:
18+
id-token: write # OIDC token for npm trusted publishing
19+
contents: write # semantic-release pushes the release tag
20+
issues: write
21+
pull-requests: write
1822

1923
jobs:
2024
publish:
2125
runs-on: ubuntu-latest
22-
permissions:
23-
contents: read
24-
id-token: write # OIDC token for npm trusted publishing
25-
defaults:
26-
run:
27-
working-directory: packages/create-clanker-support
2826
steps:
2927
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
persist-credentials: false
31+
- uses: pnpm/action-setup@v4
3032
- uses: actions/setup-node@v4
3133
with:
32-
node-version: 22
34+
# Node 24 bundles npm >= 11.5.1, required for trusted publishing.
35+
node-version: 24
36+
cache: pnpm
3337
registry-url: https://registry.npmjs.org
34-
# Node 22 bundles npm 10; trusted publishing needs npm >= 11.5.1.
35-
- run: npm install -g npm@11
36-
- name: Assert tag matches package version
37-
run: |
38-
TAG_VERSION="${GITHUB_REF_NAME#create-clanker-support@}"
39-
PKG_VERSION="$(node -p "require('./package.json').version")"
40-
test "$TAG_VERSION" = "$PKG_VERSION" || { echo "tag $TAG_VERSION != package.json $PKG_VERSION"; exit 1; }
41-
- run: npm install --no-package-lock
38+
- run: pnpm install --frozen-lockfile
4239
- name: Smoke test
40+
working-directory: packages/create-clanker-support
4341
run: node index.mjs --help | grep -q "create-clanker-support"
44-
- name: Publish
45-
run: npm publish --access public
42+
- name: Semantic Release
43+
working-directory: packages/create-clanker-support
44+
run: pnpm semantic-release
45+
env:
46+
GITHUB_TOKEN: ${{ github.token }}

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm commitlint --edit $1

package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,19 @@
88
},
99
"packageManager": "pnpm@10.0.0",
1010
"scripts": {
11-
"build": "pnpm -r build"
11+
"build": "pnpm -r build",
12+
"postinstall": "husky"
13+
},
14+
"commitlint": {
15+
"extends": "@steebchen/commitlint-config"
16+
},
17+
"devDependencies": {
18+
"@semantic-release/exec": "^7.1.0",
19+
"@steebchen/commitlint-config": "^1.7.0",
20+
"commitlint": "21.0.1",
21+
"husky": "^9.1.7",
22+
"semantic-release": "^24.2.5",
23+
"semantic-release-monorepo": "8.0.2"
1224
},
1325
"pnpm": {
1426
"onlyBuiltDependencies": [
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"branches": ["main"],
3+
"tagFormat": "create-clanker-support@${version}",
4+
"extends": "semantic-release-monorepo",
5+
"plugins": [
6+
"@semantic-release/commit-analyzer",
7+
"@semantic-release/release-notes-generator",
8+
[
9+
"@semantic-release/exec",
10+
{
11+
"prepareCmd": "npm pkg set version=${nextRelease.version}",
12+
"publishCmd": "npm publish --provenance --access public"
13+
}
14+
]
15+
]
16+
}

0 commit comments

Comments
 (0)