-
Notifications
You must be signed in to change notification settings - Fork 24
chore: create common action to setup Node.js and correct version of npm #2652
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
Changes from all commits
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 |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: "Setup Node and npm" | ||
| description: "Set up Node.js and ensure an npm supporting 'id-token' is installed" | ||
|
|
||
| inputs: | ||
| node-version: | ||
| description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.' | ||
| required: false | ||
| default: '22.x' | ||
| cache: | ||
| description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.' | ||
| required: false | ||
| default: 'npm' | ||
| cache-dependency-path: | ||
| description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.' | ||
| required: true | ||
| registry-url: | ||
| description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.' | ||
| required: false | ||
| default: '' | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Set up Node.js | ||
| # Use whatever version of setup-node you actually want here | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: ${{ inputs.node-version }} | ||
| cache: ${{ inputs.cache }} | ||
| registry-url: ${{ inputs.registry-url }} | ||
| cache-dependency-path: ${{ inputs.cache-dependency-path }} | ||
|
|
||
| - name: Update npm to at least 11.5.1 | ||
| shell: bash | ||
| run: | | ||
| npm install -g npm@11 | ||
| echo "npm version: $(npm --version)" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ on: | |
| required: true | ||
|
|
||
| permissions: | ||
| id-token: write # Required for OIDC | ||
| contents: write | ||
| statuses: write | ||
|
|
||
|
|
@@ -27,7 +28,6 @@ env: | |
| RELEASE_BRANCH_NAME: release-${{github.event.inputs.release-version || github.ref_name}} | ||
| LATEST_FULL_RELEASE_TAG: _LATEST-FULL-RELEASE | ||
| TEST_RUN: ${{startsWith(github.event.inputs.release-version || github.ref_name, 'v0.0.1')}} | ||
| NODE_VERSION: 22.x | ||
|
|
||
| jobs: | ||
| validate-release-version: | ||
|
|
@@ -442,11 +442,9 @@ jobs: | |
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{env.RELEASE_BRANCH_NAME}} | ||
| - name: Set up NodeJs | ||
| uses: actions/setup-node@v6 | ||
| - name: Setup Node and npm | ||
| uses: ./.github/workflows/common/setup-node-and-npm | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: "npm" | ||
| registry-url: "https://registry.npmjs.org" | ||
| cache-dependency-path: js/api-augment/package-lock.json | ||
| - name: Install | ||
|
|
@@ -489,11 +487,9 @@ jobs: | |
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{env.RELEASE_BRANCH_NAME}} | ||
| - name: Set up NodeJs | ||
| uses: actions/setup-node@v6 | ||
| - name: Setup Node and npm | ||
| uses: ./.github/workflows/common/setup-node-and-npm | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: "npm" | ||
| registry-url: "https://registry.npmjs.org" | ||
| cache-dependency-path: js/ethereum-utils/package-lock.json | ||
| - name: Install | ||
|
|
@@ -518,11 +514,9 @@ jobs: | |
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{env.RELEASE_BRANCH_NAME}} | ||
| - name: Set up NodeJs | ||
| uses: actions/setup-node@v6 | ||
| - name: Setup Node and npm | ||
| uses: ./.github/workflows/common/setup-node-and-npm | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: "npm" | ||
| registry-url: "https://registry.npmjs.org" | ||
| cache-dependency-path: js/schemas/package-lock.json | ||
| - name: Install | ||
|
|
@@ -547,11 +541,9 @@ jobs: | |
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{env.RELEASE_BRANCH_NAME}} | ||
| - name: Set up NodeJs | ||
| uses: actions/setup-node@v6 | ||
| - name: Setup Node and npm | ||
| uses: ./.github/workflows/common/setup-node-and-npm | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: "npm" | ||
| registry-url: "https://registry.npmjs.org" | ||
| cache-dependency-path: js/recovery-sdk/package-lock.json | ||
| - name: Install | ||
|
|
@@ -1235,11 +1227,9 @@ jobs: | |
| uses: ./.github/workflows/common/is-full-release | ||
| with: | ||
| version-tag: ${{env.NEW_RELEASE_TAG}} | ||
| - name: Set up NodeJs | ||
| uses: actions/setup-node@v6 | ||
| - name: Setup Node and npm | ||
| uses: ./.github/workflows/common/setup-node-and-npm | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: "npm" | ||
| registry-url: "https://registry.npmjs.org" | ||
| cache-dependency-path: js/api-augment/package-lock.json | ||
| - name: Download Dist Dir | ||
|
|
@@ -1281,11 +1271,9 @@ jobs: | |
| uses: ./.github/workflows/common/is-full-release | ||
| with: | ||
| version-tag: ${{env.NEW_RELEASE_TAG}} | ||
| - name: Set up NodeJs | ||
| uses: actions/setup-node@v6 | ||
| - name: Setup Node and npm | ||
| uses: ./.github/workflows/common/setup-node-and-npm | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: "npm" | ||
| registry-url: "https://registry.npmjs.org" | ||
| cache-dependency-path: js/ethereum-utils/package-lock.json | ||
| - name: Download Dist Dir | ||
|
|
@@ -1327,11 +1315,9 @@ jobs: | |
| uses: ./.github/workflows/common/is-full-release | ||
| with: | ||
| version-tag: ${{env.NEW_RELEASE_TAG}} | ||
| - name: Set up NodeJs | ||
| uses: actions/setup-node@v6 | ||
| - name: Setup Node and npm | ||
| uses: ./.github/workflows/common/setup-node-and-npm | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: "npm" | ||
| registry-url: "https://registry.npmjs.org" | ||
| cache-dependency-path: js/schemas/package-lock.json | ||
| - name: Download Dist Dir | ||
|
|
@@ -1373,11 +1359,9 @@ jobs: | |
| uses: ./.github/workflows/common/is-full-release | ||
| with: | ||
| version-tag: ${{env.NEW_RELEASE_TAG}} | ||
| - name: Set up NodeJs | ||
| uses: actions/setup-node@v6 | ||
| - name: Setup Node and npm | ||
| uses: ./.github/workflows/common/setup-node-and-npm | ||
|
Collaborator
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. I'm seeing the use NODE_AUTH_TOKEN and want to make sure that is different from what Scott mentioned for
Collaborator
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. It's only referenced in the description for the I think |
||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: "npm" | ||
| registry-url: "https://registry.npmjs.org" | ||
| cache-dependency-path: js/recovery-sdk/package-lock.json | ||
| - name: Download Dist Dir | ||
|
|
||
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.
non-blocking: Is 22 the one we still want or should we go up to 24.x?