Skip to content

Commit d20d5c3

Browse files
chore: update NPM to ^11.5.1, switch to OIDC NPM Auth (#1256)
## This PR - updates the NPM version to `^11.5.1` needed for OIDC NPM auth: https://docs.npmjs.com/trusted-publishers/#github-actions-configuration - Switches from NPM tokens to NPM OIDC auth so we can disable NPM publish tokens. - updates the base node version in actions to node 22 (current LTS) <!-- av pr metadata This information is embedded by the av CLI when creating PRs to track the status of stacks when using Aviator. Please do not delete or edit this section of the PR. ``` {"parent":"main","parentHead":"","trunk":"main"} ``` --> --------- Signed-off-by: Jonathan Norris <[email protected]>
1 parent 973a79e commit d20d5c3

File tree

8 files changed

+96
-449
lines changed

8 files changed

+96
-449
lines changed

.github/workflows/audit-pending-releases.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on:
22
push:
33
branches:
4-
- 'release-please**'
4+
- "release-please**"
55

66
env:
77
CORE_PACKAGE: core
@@ -29,6 +29,6 @@ jobs:
2929
- name: Setup Node
3030
uses: actions/setup-node@v4
3131
with:
32-
node-version: 20
32+
node-version-file: ".nvmrc"
3333
registry-url: "https://registry.npmjs.org"
34-
cache: 'npm'
34+
cache: "npm"

.github/workflows/coverage.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- uses: actions/setup-node@v4
1717
with:
18-
registry-url: 'https://registry.npmjs.org'
19-
node-version: 20
20-
cache: 'npm'
18+
registry-url: "https://registry.npmjs.org"
19+
node-version-file: ".nvmrc"
20+
cache: "npm"
2121

2222
- name: Install
2323
run: npm ci

.github/workflows/pr-checks.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
uses: actions/setup-node@v4
2727
with:
2828
node-version: ${{ matrix.node-version }}
29-
cache: 'npm'
29+
cache: "npm"
3030

3131
- name: Install
3232
run: npm ci
@@ -50,8 +50,8 @@ jobs:
5050
- uses: actions/checkout@v4
5151
- uses: actions/setup-node@v4
5252
with:
53-
node-version: 20
54-
cache: 'npm'
53+
node-version-file: ".nvmrc"
54+
cache: "npm"
5555

5656
- name: Install
5757
run: npm ci
@@ -72,8 +72,8 @@ jobs:
7272
- uses: actions/checkout@v4
7373
- uses: actions/setup-node@v4
7474
with:
75-
node-version: 20
76-
cache: 'npm'
75+
node-version-file: ".nvmrc"
76+
cache: "npm"
7777

7878
- name: Install
7979
run: npm ci

.github/workflows/release-please.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ on:
22
push:
33
branches:
44
- main
5+
56
name: Run Release Please
7+
68
jobs:
79
release-please:
810
runs-on: ubuntu-latest
@@ -27,28 +29,31 @@ jobs:
2729
if: ${{ fromJSON(needs.release-please.outputs.paths_released)[0] != null }}
2830
# Continues with the release process even if SBOM generation fails.
2931
continue-on-error: true
32+
permissions:
33+
id-token: write
34+
attestations: write
35+
contents: read
3036
strategy:
3137
matrix:
3238
release: ${{ fromJSON(needs.release-please.outputs.paths_released) }}
33-
env:
34-
TAG: ${{ fromJSON(needs.release-please.outputs.all)[format('{0}--tag_name', matrix.release)] }}
3539
steps:
3640
- name: Checkout Repository
3741
uses: actions/checkout@v4
3842
- name: Setup Node
3943
uses: actions/setup-node@v4
4044
with:
41-
node-version: 20
45+
node-version-file: ".nvmrc"
46+
- name: Update npm to >=11.5.1 (for OIDC support)
47+
run: npm install -g npm@^11.5.1
48+
- name: Install dependencies
49+
run: npm ci
4250
- name: Generate SBOM
43-
run: |
44-
npm install -g npm@^10.2.0
45-
npm ci
46-
npm sbom --sbom-format=cyclonedx --omit=dev --omit=peer --workspace=${{matrix.release}} > bom.json
47-
- name: Attach SBOM to artifact
48-
env:
49-
GITHUB_TOKEN: ${{secrets.RELEASE_PLEASE_ACTION_TOKEN}}
50-
run:
51-
gh release upload $TAG bom.json
51+
run: npm sbom --sbom-format=cyclonedx --omit=dev --omit=peer --workspace=${{ matrix.release }} > sbom.json
52+
- name: Attest SBOM
53+
uses: actions/attest-sbom@v3
54+
with:
55+
subject-path: ${{ matrix.release }}/package.json
56+
sbom-path: ./sbom.json
5257

5358
npm-release:
5459
needs: release-please
@@ -65,9 +70,11 @@ jobs:
6570
- name: Setup Node
6671
uses: actions/setup-node@v4
6772
with:
68-
node-version: 20
73+
node-version-file: ".nvmrc"
6974
registry-url: "https://registry.npmjs.org"
70-
cache: 'npm'
75+
cache: "npm"
76+
- name: Update npm (for OIDC auth)
77+
run: npm install -g npm@^11.5.1
7178
- name: Build Packages
7279
run: |
7380
npm ci
@@ -77,7 +84,6 @@ jobs:
7784
# Our scripts only publish versions that do not already exist.
7885
- name: Publish to NPM
7986
env:
80-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
8187
# https://docs.npmjs.com/generating-provenance-statements
8288
NPM_CONFIG_PROVENANCE: true
8389
run: npm run publish-all

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ typedoc
112112

113113
# IDE
114114
.idea
115+
.cursor/
115116

116117
# license files copied from root
117118
packages/**/LICENSE

.nvmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
22
2+

0 commit comments

Comments
 (0)