|
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: |
5 | 7 | # org: theopenco repo: clankersupport-templates |
6 | 8 | # 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. |
12 | 11 | name: Release CLI |
13 | 12 |
|
14 | 13 | on: |
15 | 14 | 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 |
18 | 22 |
|
19 | 23 | jobs: |
20 | 24 | publish: |
21 | 25 | 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 |
28 | 26 | steps: |
29 | 27 | - uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
| 30 | + persist-credentials: false |
| 31 | + - uses: pnpm/action-setup@v4 |
30 | 32 | - uses: actions/setup-node@v4 |
31 | 33 | with: |
32 | | - node-version: 22 |
| 34 | + # Node 24 bundles npm >= 11.5.1, required for trusted publishing. |
| 35 | + node-version: 24 |
| 36 | + cache: pnpm |
33 | 37 | 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 |
42 | 39 | - name: Smoke test |
| 40 | + working-directory: packages/create-clanker-support |
43 | 41 | 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 }} |
0 commit comments