Skip to content

Commit 5f9237c

Browse files
DavertMikclaude
andcommitted
ci: mirror main codeceptjs publish-beta.yml exactly
Restores the pattern from codeceptjs/codeceptjs .github/workflows/publish-beta.yml: - setup-node with registry-url - npm install → npm install -g npm@latest (load-bearing: npm 10.9 bundled with Node 22 does NOT support OIDC trusted publishing; only npm 11.5+ does, so the upgrade is what actually makes the auth work) - --provenance publish via trusted publishing, no NPM_TOKEN I wrongly dropped both registry-url and the npm upgrade across earlier attempts, chasing theories about .npmrc interference and an arborist bug. The main repo pattern handles those issues correctly. Keeps our additions on top of the mirror: - dist-tag detection (latest vs beta) - plain SemVer tag (no `v` strip) - --access public (needed because @codeceptjs/reflection is a new scoped package) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2a79b57 commit 5f9237c

File tree

1 file changed

+11
-40
lines changed

1 file changed

+11
-40
lines changed

.github/workflows/publish.yml

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
name: Publish to npm
22

33
# Auto-publishes @codeceptjs/reflection to npm on every GitHub release.
4-
# Uses npm provenance (sigstore transparency log) so the published package
5-
# is cryptographically linked to this repo (codeceptjs/reflection) and the
6-
# exact workflow run that built it.
4+
# Mirrors codeceptjs/codeceptjs `.github/workflows/publish-beta.yml` — same
5+
# pattern: setup-node with registry-url, local install, upgrade npm to latest,
6+
# set version from release tag, publish with --provenance via trusted publishing.
77
#
88
# Tag the release with a plain SemVer tag like `0.4.0` or `0.5.0-beta.1`
99
# (no `v` prefix).
10-
# - Stable tags (no prerelease suffix) publish under the default `latest` dist-tag.
10+
# - Stable tags publish under the default `latest` dist-tag.
1111
# - Prereleases (alpha/beta/rc) publish under the `beta` dist-tag.
1212

1313
on:
1414
release:
1515
types: [published]
1616

17-
# Required for npm provenance: id-token grants OIDC to the workflow so npm
18-
# can verify the build came from this repository's Actions runner.
1917
permissions:
2018
contents: read
2119
id-token: write
@@ -26,44 +24,21 @@ jobs:
2624
runs-on: ubuntu-latest
2725

2826
steps:
29-
- name: Checkout codeceptjs/reflection at release ref
30-
uses: actions/checkout@v4
27+
- uses: actions/checkout@v4
3128
with:
3229
ref: ${{ github.event.release.target_commitish }}
3330

34-
# IMPORTANT: do NOT pass `registry-url` to setup-node here.
35-
# When registry-url is set, setup-node writes a .npmrc with
36-
# //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
37-
# and with no NODE_AUTH_TOKEN in env, npm sends an empty Bearer
38-
# header which short-circuits the trusted-publishing OIDC flow
39-
# (sigstore still works, but the final PUT gets rejected as 404).
40-
# Omitting registry-url lets npm use its default registry and
41-
# attempt OIDC automatically for packages with a configured
42-
# trusted publisher.
43-
- name: Setup Node 22
44-
uses: actions/setup-node@v4
31+
- uses: actions/setup-node@v4
4532
with:
4633
node-version: 22
34+
registry-url: 'https://registry.npmjs.org'
4735

48-
- name: Install dependencies
49-
run: npm install
36+
- run: npm install
37+
- run: npm install -g npm@latest
5038

51-
# NOTE: we intentionally do NOT run `npm install -g npm@latest` here.
52-
# Under Node 22.22+ that step hits a known arborist regression
53-
# (`Cannot find module 'promise-retry'`) that breaks the publish.
54-
# Node 22 already ships with npm >= 10.9, and npm has supported
55-
# --provenance since 9.5, so the upgrade was cosmetic.
56-
57-
- name: Typecheck
58-
run: npm run typecheck
59-
60-
- name: Run tests before publishing
61-
run: npm test
62-
63-
- name: Set package version from release tag
39+
- name: Set package version
6440
run: |
6541
VERSION="${{ github.event.release.tag_name }}"
66-
echo "Publishing @codeceptjs/reflection version $VERSION"
6742
npm version "$VERSION" --no-git-tag-version
6843
6944
- name: Determine dist-tag
@@ -78,9 +53,5 @@ jobs:
7853
echo "tag=latest" >> "$GITHUB_OUTPUT"
7954
fi
8055
81-
# `--provenance` requires npm >= 9.5.0; Node 22's bundled npm is 10.9+.
82-
# Auth uses npm trusted publishing via OIDC (id-token: write above) —
83-
# no NPM_TOKEN secret needed. The published package gets a provenance
84-
# statement linking it to this workflow run at github.com/codeceptjs/reflection.
85-
- name: Publish to npm with provenance
56+
- name: Publish to npm
8657
run: npm publish --provenance --access public --tag ${{ steps.disttag.outputs.tag }}

0 commit comments

Comments
 (0)