-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ci): rewrite CI for npm publish #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
150aa00
eeb2d16
672f9ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,8 +17,6 @@ jobs: | |
| contents: read | ||
| outputs: | ||
| version: ${{ steps.version.outputs.version }} | ||
| major: ${{ steps.version.outputs.major }} | ||
| major-minor: ${{ steps.version.outputs.major-minor }} | ||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
|
@@ -35,13 +33,8 @@ jobs: | |
| REF_NAME: ${{ github.ref_name }} | ||
| run: | | ||
| version="${REF_NAME#v}" | ||
| major="${version%%.*}" | ||
| rest="${version#*.}" | ||
| minor="${rest%%.*}" | ||
|
|
||
| echo "version=$version" >> "$GITHUB_OUTPUT" | ||
| echo "major=$major" >> "$GITHUB_OUTPUT" | ||
| echo "major-minor=$major.$minor" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Extract release notes | ||
| shell: bash | ||
|
|
@@ -65,3 +58,44 @@ jobs: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| VERSION: ${{ steps.version.outputs.version }} | ||
| run: gh release create "v$VERSION" --notes-file release-notes.md --discussion-category announcements | ||
|
|
||
| publish: | ||
| name: Publish to npm | ||
| runs-on: ubuntu-22.04 | ||
| timeout-minutes: 5 | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - 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' | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Spec, minor] The research doc calls out |
||
|
|
||
| - name: Install dependencies | ||
| shell: bash | ||
| run: pnpm i | ||
|
Comment on lines
+75
to
+87
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Standards] This duplicates |
||
|
|
||
| - name: Build library | ||
| shell: bash | ||
| run: pnpm build | ||
|
|
||
| # Trusted Publishing exchanges the job's OIDC token (`id-token: write` above) for a | ||
| # short-lived publish credential; no NPM_TOKEN secret is involved. `npm stage publish` | ||
| # (rather than `npm publish`) uploads to the stage queue and doesn't require 2FA, so it | ||
| # completes from an unattended CI job; a maintainer separately approves it with 2FA | ||
| # (CLI or npmjs.com) before it becomes the installable version. | ||
| - name: Publish to npm stage queue | ||
| shell: bash | ||
| working-directory: dist/template-lib-angular | ||
| run: npm stage publish | ||
There was a problem hiding this comment.
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 publishfails with no signal tied to this requirement. Consider adding an explicit version check ornpm install -g npm@latestbefore the publish step.