Skip to content

feat: add npm publish workflow for @dash0hq/docs-invariants#1

Merged
mmanciop merged 1 commit into
mainfrom
feat/npm-publish-workflow
Jul 8, 2026
Merged

feat: add npm publish workflow for @dash0hq/docs-invariants#1
mmanciop merged 1 commit into
mainfrom
feat/npm-publish-workflow

Conversation

@mmanciop

@mmanciop mmanciop commented Jul 8, 2026

Copy link
Copy Markdown
Member

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.md into 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 matches package.json version, reinstalls, runs typecheck + tests, then publishes with pnpm --filter @dash0hq/docs-invariants publish --access public --no-git-checks. Uses id-token: write for npm provenance and reads NODE_AUTH_TOKEN from DASH0_NPMJS_PUBLISH_TOKEN.
  • packages/docs-invariants/package.json — un-masked for publication (private: true removed), version bumped to 0.0.1, added repository (with directory subpath), homepage, bugs, publishConfig (access: public, provenance: true), main, exports, and a files list using a negation glob to keep test files out of the tarball.
  • packages/docs-invariants/LICENSE — symlinked to the repo-root LICENSE. 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

  1. Create an npm automation token with publish access on the @dash0hq scope.
  2. Add it as a repository secret on dash0hq/sync-docs-action named DASH0_NPMJS_PUBLISH_TOKEN.
  3. Confirm the @dash0hq npm 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 lint clean; format:check clean; typecheck clean; 87 + 1 tests pass.
  • pnpm pack inside packages/docs-invariants/ contains only LICENSE, README.md, package.json, src/index.ts.

Test plan

  • CI runs and passes on this PR.
  • After merge, add the npm secret, push tag docs-invariants-v0.0.1, confirm workflow publishes and npm view @dash0hq/docs-invariants shows the version with a provenance attestation link.

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.
@mmanciop mmanciop merged commit 802854f into main Jul 8, 2026
1 check passed
@mmanciop mmanciop deleted the feat/npm-publish-workflow branch July 8, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant