feat: add npm publish workflow for @dash0hq/docs-invariants#1
Merged
Conversation
Sets up the release pipeline so tag pushes matching `docs-invariants-v<X.Y.Z>` (or `-<pre-release>`) publish the package to npm with provenance attestations. Workflow (.github/workflows/publish.yml): - Tag-triggered on the `docs-invariants-v*` pattern. - Permissions: `contents: read` + `id-token: write` (for npm provenance). - Steps: checkout → setup-node with npm registry → setup-pnpm → install → verify tag matches package.json version → typecheck → test → `pnpm --filter @dash0hq/docs-invariants publish --access public --no-git-checks` with NPM_CONFIG_PROVENANCE=true and NODE_AUTH_TOKEN sourced from the DASH0_NPMJS_PUBLISH_TOKEN secret. - Refuses to publish when the tag version and package.json version disagree, so a mis-typed tag can't push mismatched metadata. Package (packages/docs-invariants/package.json): - Flipped `private: true` → removed; ready to publish. - Bumped version to 0.0.1. - Added `repository` (with `directory` subpath), `homepage`, `bugs`, `publishConfig` (`access: public`, `provenance: true`), `main`, `exports`. - `files` uses a negation glob (`src/**/*.ts` + `!src/**/*.test.ts`) so test files stay out of the published tarball. Verified with `pnpm pack`: tarball contains only LICENSE, README.md, package.json, and src/index.ts. - Symlinked LICENSE into the package so npm publish picks it up alongside the source; the symlink resolves to the repo-root Apache 2.0 text at pack time. Docs (docs/releasing.md): - Replaced the placeholder release procedure with the actual tag/workflow/secret contract, including the version-mismatch guard and support for pre-release tags. Prerequisites the user must set up before the first release runs: - Create an npm automation token with publish access on the @dash0hq scope, and add it as the DASH0_NPMJS_PUBLISH_TOKEN repository secret on this repo. - Confirm the @dash0hq npm scope exists and the token has publish permission there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sets up the release pipeline so tag pushes matching
docs-invariants-v<X.Y.Z>(or with a pre-release suffix like-alpha.1) publish the package to npm with provenance attestations.The initial main push landed the scaffold; this PR turns the "docs-invariants publishes to npm" story from a promise in
docs/releasing.mdinto a working workflow. First real release,docs-invariants-v0.0.1, can be cut immediately after this merges — it reserves the npm name and validates the pipeline end-to-end while the package's actual API is still being designed.What's included
.github/workflows/publish.yml— tag-triggered release workflow. Verifies tag version matchespackage.jsonversion, reinstalls, runs typecheck + tests, then publishes withpnpm --filter @dash0hq/docs-invariants publish --access public --no-git-checks. Usesid-token: writefor npm provenance and readsNODE_AUTH_TOKENfromDASH0_NPMJS_PUBLISH_TOKEN.packages/docs-invariants/package.json— un-masked for publication (private: trueremoved), version bumped to0.0.1, addedrepository(withdirectorysubpath),homepage,bugs,publishConfig(access: public,provenance: true),main,exports, and afileslist using a negation glob to keep test files out of the tarball.packages/docs-invariants/LICENSE— symlinked to the repo-rootLICENSE. Resolves to the actual Apache 2.0 text when npm packs the tarball, so the published package carries the licence without a redundant copy in the repo.docs/releasing.md— replaces the placeholder release procedure with the actual tag/workflow/secret contract, including the version-mismatch guard and the pre-release-tag pattern.Prerequisites the user needs to set up before the first release runs
@dash0hqscope.dash0hq/sync-docs-actionnamedDASH0_NPMJS_PUBLISH_TOKEN.@dash0hqnpm scope exists and the token has publish permission on it.None of these block this PR — they gate the first tag push after merge.
Verification
pnpm run lintclean;format:checkclean;typecheckclean; 87 + 1 tests pass.pnpm packinsidepackages/docs-invariants/contains onlyLICENSE,README.md,package.json,src/index.ts.Test plan
docs-invariants-v0.0.1, confirm workflow publishes andnpm view @dash0hq/docs-invariantsshows the version with a provenance attestation link.