Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .changeset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ Add a changeset with:
vp exec changeset
```

Merging the resulting release PR on `main` is what triggers the publish workflow.
Merging the resulting release PR on `main` makes the publish workflow stage the
new version on npm. It goes public once a maintainer approves it with
`npm stage approve <stage-id>` (2FA), using the stage ID from the workflow log.
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,11 @@ jobs:
- name: Validate release
run: pnpm run release:check

- name: Publish to npm
run: pnpm run release
- name: Stage on npm
run: |
version="$(node -p "require('./package.json').version")"
if [ -n "$(npm view "obsidian-e2e@$version" version 2>/dev/null)" ]; then
echo "obsidian-e2e@$version is already published"
exit 0
fi
pnpm run release
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -896,12 +896,15 @@ At a high level:
`.obsidian-e2e-artifacts` so maintainers can inspect the same failure
snapshots produced locally.
- Releases go through Changesets PRs. Merge the version PR that
Changesets opens, then let the release workflow publish to npm.
Changesets opens, and the release workflow stages the version on npm. It
goes public once a maintainer approves it with `npm stage approve
<stage-id>` (2FA).

Maintainer setup notes:

- Configure npm trusted publishing for this package and repository so the
GitHub release workflow can publish without a long-lived npm token.
GitHub release workflow can stage releases without a long-lived npm token.
Allow only `npm stage publish` on the trusted publisher, not `npm publish`.
- Grant the publish job `id-token: write` so GitHub can mint the OIDC token npm
expects, and keep the release workflow permissions aligned with the write
actions it needs, such as `contents: write` and `pull-requests: write` for
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"url": "git+https://github.com/chhoumann/obsidian-e2e.git"
},
"bin": {
"obsidian-e2e": "./dist/runner/bin.mjs"
"obsidian-e2e": "dist/runner/bin.mjs"
},
"files": [
"dist"
Expand Down Expand Up @@ -51,7 +51,7 @@
"check": "vp check",
"changeset": "changeset",
"dev": "vp pack --watch",
"release": "changeset publish",
"release": "npm stage publish --provenance",
"release:check": "vp check && vp test && vp pack",
"test": "vp test",
"typecheck": "tsc --noEmit",
Expand Down
Loading