Publishing Packages
Publishing Method
Section titled “Publishing Method”npm package publishing is triggered manually through GitHub Actions workflow:
.github/workflows/publish-libs.yaml
The trigger is workflow_dispatch with a mode parameter:
dry-run: rehearses versioning and publishing flow without actual publishing.publish: performs real release and pushes release commit/tag.
Preconditions
Section titled “Preconditions”publishmust be triggered from themainbranch.dry-runcan be triggered from other branches.- A release plan file must exist in
.nx/version-plans/.
Workflow Steps Summary
Section titled “Workflow Steps Summary”- When
mode=publish, strictly validate current branch ismain. - Install dependencies and release environment (pnpm, Node 24).
- Validate trusted publishing runtime requirements (Node version, etc.).
- Run
pnpm install --frozen-lockfile. - Run
npx nx release --skip-publish --preid alphato create release commit and tags. - Format
package.jsonand amend the release commit. - When
mode=publish:git push origin HEAD:main --follow-tags- Adjust pre-publish manifest handling (force npm registries, prepare npm manifests)
- Run
npx nx release publish --excludeTaskDependenciesto publish to npm.
Recommended Process
Section titled “Recommended Process”- Trigger
mode=dry-runfirst, and confirm version changes and pre-publish checks are correct (no tags pushed and no npm publish in this mode). - Trigger
mode=publishto perform the formal release. - Verify npm packages and GitHub tags after publishing.