Skip to content

Commit 0ec040d

Browse files
chore: centralize Node/npm setup to fix CI failures (#772)
1 parent 8907ec7 commit 0ec040d

File tree

5 files changed

+2309
-1993
lines changed

5 files changed

+2309
-1993
lines changed

.github/actions/build/action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ runs:
1111
using: composite
1212

1313
steps:
14-
- name: Setup Node
15-
uses: actions/setup-node@v3
14+
- name: Setup Node and npm
15+
uses: ./.github/actions/setup-node-npm
1616
with:
1717
node-version: ${{ inputs.node }}
18-
cache: 'npm'
1918

2019
- name: Install dependencies
2120
shell: bash

.github/actions/npm-publish/action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
name: Publish release to npm
2+
description: Publish SDK package to npm
23

34
inputs:
45
node-version:
6+
description: Node.js version to use
57
required: true
68
version:
9+
description: Version being published
710
required: true
811
require-build:
12+
description: Whether to build before publishing
913
default: true
1014
release-directory:
15+
description: Directory to publish from
1116
default: './'
1217

1318
runs:
@@ -17,17 +22,12 @@ runs:
1722
- name: Checkout code
1823
uses: actions/checkout@v4
1924

20-
- name: Setup Node
21-
uses: actions/setup-node@v4
25+
- name: Setup Node and npm
26+
uses: ./.github/actions/setup-node-npm
2227
with:
2328
node-version: ${{ inputs.node-version }}
24-
cache: 'npm'
2529
registry-url: 'https://registry.npmjs.org'
2630

27-
- name: Update npm to version 11
28-
shell: bash
29-
run: npm install -g npm@11
30-
3131
- name: Install dependencies
3232
shell: bash
3333
run: npm ci --include=dev
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Setup Node and npm
2+
description: Setup Node.js and upgrade npm to version 11 for trusted publishing support
3+
4+
inputs:
5+
node-version:
6+
description: The Node version to use
7+
required: false
8+
default: '22'
9+
cache:
10+
description: Enable npm caching
11+
required: false
12+
default: 'npm'
13+
registry-url:
14+
description: Registry URL for publishing
15+
required: false
16+
17+
runs:
18+
using: composite
19+
20+
steps:
21+
- name: Setup Node
22+
uses: actions/setup-node@v6
23+
with:
24+
node-version: ${{ inputs.node-version }}
25+
cache: ${{ inputs.cache }}
26+
registry-url: ${{ inputs.registry-url }}
27+
28+
- name: Update npm to version 11
29+
shell: bash
30+
run: npm install -g npm@11

.github/workflows/publish.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,10 @@ jobs:
9393
fetch-depth: 0
9494
ref: ${{ github.event.inputs.branch }}
9595

96-
- name: Setup Node
97-
uses: actions/setup-node@v6
96+
- name: Setup Node and npm
97+
uses: ./.github/actions/setup-node-npm
9898
with:
9999
node-version: ${{ env.NODE_VERSION }}
100-
cache: npm
101100
registry-url: 'https://registry.npmjs.org'
102101

103102
- name: Install dependencies

0 commit comments

Comments
 (0)