Skip to content

feat(ci): rewrite CI for npm publish - #11

Open
NoNamer777 wants to merge 3 commits into
mainfrom
feat/rewrite-ci-for-npm-publish
Open

feat(ci): rewrite CI for npm publish#11
NoNamer777 wants to merge 3 commits into
mainfrom
feat/rewrite-ci-for-npm-publish

Conversation

@NoNamer777

@NoNamer777 NoNamer777 commented Aug 14, 2026

Copy link
Copy Markdown
Member

Summary

Rewrites release-publish.yml/release-prepare.yml to publish @dnd-mapp/template-lib-angular to npm instead of building/publishing Docker images, per the research findings in Research npm Trusted Publishing + staged publishing (#4):

  • Adds a publish job to release-publish.yml that builds the library and runs npm stage publish, authenticated via GitHub Actions OIDC (id-token: write) instead of a stored NPM_TOKEN. Staging rather than publishing directly means a maintainer still approves the version with 2FA before it goes live, so CI never has the power to make a version public on its own. This job will fail until the one-time manual bootstrap publish and the npm Trusted Publisher link (#6) are done, which is expected per the map's decision to leave the pipeline wired-but-unexercised for now.
  • Drops the release job's major/major-minor outputs, dead since the Docker image-tagging job that consumed them was already removed in #3.
  • Fixes release-prepare.yml's version-bump step, which bumped the workspace root's package.json even though ng-packagr actually publishes projects/template-lib-angular/package.json's version. The two have been independent since scaffolding (root stuck at 0.0.0, library at 0.0.1). Left unfixed, every release would tag/changelog one version while npm published a different, never-bumped one.
  • Confirmed sign-and-push-tag is not Docker-specific (it's the SSH tag-signing step used by release-prepare.yml/release-retry-tag.yml) and left it untouched.
  • ci/action.yml and prepare-workspace/action.yml already reflect the library's build/lint/test/typecheck pipeline from #3; no changes needed there.

Related issues

Resolves #5

Checklist

  • Title and description follow the Creating a Pull Request guide
  • Commit messages follow Conventional Commits and are grouped by intent
  • Tests were added or updated as needed
  • Documentation was updated as needed
  • CI checks pass

Removing the app-runtime Docker scaffolding already dropped the promote-image
job that consumed these to tag major/major-minor floating Docker image tags;
nothing reads them anymore.
Adds a publish job to release-publish.yml that builds the library and runs
npm stage publish, authenticated via GitHub Actions OIDC (id-token: write)
instead of a stored NPM_TOKEN. Staging rather than publishing directly means
a maintainer still has to approve the version with 2FA before it goes live;
CI itself never has the power to make a version public on its own.

Trusted Publishing and staged publishing both require the package to already
exist on the registry, so this only takes effect once the one-time manual
bootstrap publish and the npm Trusted Publisher link
(#6) are done; until then this job will fail,
which is expected per the map's decision to leave the pipeline
wired-but-unexercised for now.
…repare

release-prepare.yml bumped the workspace root's package.json, but ng-packagr
publishes projects/template-lib-angular/package.json's version — the two
have been independent since the library was scaffolded (root stuck at
0.0.0, library at 0.0.1). Left unfixed, every release would tag and
changelog one version while npm published a different, never-bumped one.
Repoints the bump step and the verified-commit-on-main mutation at the
library's package.json instead.

@NoNamer777 NoNamer777 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against issue #5 and the repo's CI/changelog conventions (Standards + Spec axes). Three inline notes below, plus two general ones for files outside this diff: no CHANGELOG.md entry for these CI changes, and no repository field in the library's package.json.

Comment on lines +75 to +87
- name: Setup Pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9

- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: 'package.json'
registry-url: 'https://registry.npmjs.org'
scope: '@dnd-mapp'

- name: Install dependencies
shell: bash
run: pnpm i

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Standards] This duplicates prepare-workspace's Setup Pnpm / Setup Node.js / Install dependencies steps instead of reusing the composite action, and it silently drops the cache: 'pnpm' step that action sets. Consider adding an optional registry-url input to .github/actions/prepare-workspace/action.yml and calling it here instead, the way the release job already does.

uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9

- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Spec] The research doc (docs/research/npm-trusted-publishing.md) requires npm CLI >= 11.15.0 for staged publishing. Nothing here checks or pins the npm CLI version; it relies on whatever version ships with the resolved Node version. If a runner resolves an older bundled npm, npm stage publish fails with no signal tied to this requirement. Consider adding an explicit version check or npm install -g npm@latest before the publish step.

with:
node-version-file: 'package.json'
registry-url: 'https://registry.npmjs.org'
scope: '@dnd-mapp'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Spec, minor] The research doc calls out package-manager-cache: false explicitly for the release job's setup-node step. This step just omits cache:, which is functionally equivalent but doesn't match the documented explicit flag. Low severity; consider adding it for consistency with the doc.

@NoNamer777

Copy link
Copy Markdown
Member Author

[Standards] This repo's Changelog Conventions treat "changed CI or build setup that's copied into the new repo" as consumer-facing for a template repo. ## [Unreleased] has no entry for this PR's changes (the npm publish job, the version-bump target fix). Please add one before merge.

@NoNamer777

Copy link
Copy Markdown
Member Author

[Spec] projects/template-lib-angular/package.json has no repository field. The research doc says it must exactly match the GitHub repo for Trusted Publishing to work. It's flagged there as possibly out of scope for this PR, but it will block publishing once the manual bootstrap and Trusted Publisher link happen. Worth a follow-up if it's not handled elsewhere.

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.

Rewrite CI for npm publish

1 participant