Skip to content

Commit f02bebd

Browse files
Copilotdmattia
andauthored
Migrate to NPM trusted publishing (#7)
* Initial plan * Implement NPM trusted publishing with actions/setup-node@v6 and npm@11.5.1 Co-authored-by: dmattia <8922077+dmattia@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dmattia <8922077+dmattia@users.noreply.github.com>
1 parent cf102c6 commit f02bebd

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v4
9-
- uses: actions/setup-node@v3.1.1
9+
- uses: actions/setup-node@v6
1010
with:
1111
node-version: '22.18.0'
1212
- run: npm install -g "yarn@1.22.5"
@@ -33,7 +33,7 @@ jobs:
3333
steps:
3434
- uses: actions/checkout@v4
3535
- name: Use Node.js ${{ matrix.node-version }}
36-
uses: actions/setup-node@v1
36+
uses: actions/setup-node@v6
3737
with:
3838
node-version: ${{ matrix.node-version }}
3939
- uses: nick-fields/retry@v2
@@ -49,7 +49,7 @@ jobs:
4949
steps:
5050
- uses: actions/checkout@v4
5151
- name: Use Node.js 22.x
52-
uses: actions/setup-node@v1
52+
uses: actions/setup-node@v6
5353
with:
5454
node-version: 22.x
5555
- uses: nick-fields/retry@v2
@@ -68,7 +68,7 @@ jobs:
6868
fetch-depth: 100 # need the history to do a changed files check below (source, origin)
6969
- uses: actions/setup-python@v2
7070
- name: Use Node.js 22.x
71-
uses: actions/setup-node@v1
71+
uses: actions/setup-node@v6
7272
with:
7373
node-version: 22.x
7474
- uses: nick-fields/retry@v2
@@ -84,28 +84,33 @@ jobs:
8484
build-to-npm:
8585
if: github.ref == 'refs/heads/main'
8686
runs-on: ubuntu-latest
87+
permissions:
88+
id-token: write
89+
contents: read
90+
packages: write
8791
needs:
8892
- run-depcheck
8993
- build-and-upload-artifacts
9094
- run-pre-commits
9195
steps:
9296
- name: Checkout
9397
uses: actions/checkout@v2
94-
- uses: actions/setup-node@v2
98+
- uses: actions/setup-node@v6
9599
with:
96100
node-version: '22.x'
101+
# See: https://docs.npmjs.com/trusted-publishers
102+
# See: https://github.com/actions/setup-node/issues/1445
103+
- name: Set npm to version that supports trusted publishers
104+
run: npm install -g npm@11.5.1
105+
shell: bash
97106
- uses: nick-fields/retry@v2
98107
with:
99108
timeout_minutes: 6
100109
max_attempts: 3
101110
retry_on: error
102111
command: yarn install --immutable
103-
- name: Configure NPM authentication
104-
run: |
105-
yarn config set npmAlwaysAuth true
106-
yarn config set npmAuthToken ${{ secrets.NPM_TOKEN }}
107112
- name: Publish to yarn/npm
108-
run: yarn npm publish
113+
run: NODE_AUTH_TOKEN="" yarn npm publish
109114

110115
build-to-github-packages:
111116
if: github.ref == 'refs/heads/main'
@@ -117,7 +122,7 @@ jobs:
117122
steps:
118123
- name: Checkout
119124
uses: actions/checkout@v2
120-
- uses: actions/setup-node@v2
125+
- uses: actions/setup-node@v6
121126
with:
122127
node-version: '22.x'
123128
- uses: nick-fields/retry@v2

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"author": "Transcend Inc.",
33
"name": "@transcend-io/handlebars-utils",
44
"description": "Utility functions for handlebars templating with Transcend - available in node and client side.",
5-
"version": "1.3.0",
5+
"version": "1.3.1",
66
"homepage": "https://github.com/transcend-io/handlebars-utils",
77
"repository": {
88
"type": "git",

0 commit comments

Comments
 (0)