-
Notifications
You must be signed in to change notification settings - Fork 475
Use OIDC publishing for abis and solidity packages #11695
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: release/core-contracts/17
Are you sure you want to change the base?
Changes from all commits
d176e1b
16b39a4
e89c285
b0fe6f8
4afbcf7
6820b7f
3f21d65
a8b4abd
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 |
|---|---|---|
|
|
@@ -41,7 +41,7 @@ permissions: | |
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ['self-hosted', 'org', 'npm-publish'] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
|
|
@@ -51,20 +51,11 @@ jobs: | |
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| - name: Akeyless Get Secrets | ||
| id: get_auth_token | ||
| uses: docker://us-west1-docker.pkg.dev/devopsre/akeyless-public/akeyless-action:latest | ||
| with: | ||
| api-url: https://api.gateway.akeyless.celo-networks-dev.org | ||
| access-id: p-kf9vjzruht6l | ||
| static-secrets: '{"/static-secrets/NPM/npm-publish-token":"NPM_TOKEN"}' | ||
|
|
||
| # Setup .npmrc file to publish to npm | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18.x' | ||
| registry-url: 'https://registry.npmjs.org' | ||
| #scope: '@celo' | ||
| node-version: '20.x' | ||
|
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. Node.js 20.x doesn't meet OIDC minimum version requirementHigh Severity npm OIDC trusted publishing requires Node.js 22.14.0 or higher, but
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. This is not true 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.
This job still runs Useful? React with 👍 / 👎. |
||
|
|
||
| - name: 'Setup yarn' | ||
| shell: bash | ||
|
|
@@ -101,6 +92,28 @@ jobs: | |
| - name: 'Get git commit hash' | ||
| id: get_COMMIT_HASH | ||
| run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
|
|
||
| - name: Update npm for OIDC trusted publishing (v11.5.1) | ||
| run: npm install -g npm@11.5.1 | ||
|
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. OIDC trusted publishing unsupported on self-hosted runnersHigh Severity npm OIDC trusted publishing currently only supports GitHub-hosted runners, not self-hosted ones. This job uses
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. Fixed |
||
|
|
||
|
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. OIDC trusted publishing doesn't authenticate
|
||
| # Fallback: ensure package.json has version (prepare script may not persist in CI) | ||
| - name: Ensure package.json has version | ||
| run: | | ||
| for pkg in packages/protocol/contracts packages/protocol/abis; do | ||
| node -e " | ||
| const fs = require('fs'); | ||
| const pkgPath = process.argv[1] + '/package.json'; | ||
| const pkg = JSON.parse(fs.readFileSync(pkgPath)); | ||
| if (!pkg.version) { | ||
| pkg.version = process.env.RELEASE_VERSION || '0.0.0-dry-run'; | ||
| pkg.private = false; | ||
| fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2)); | ||
| } | ||
| " "$pkg" | ||
| done | ||
| env: | ||
| RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | ||
|
|
||
| - name: Publish @celo/contracts | ||
| run: | | ||
| cat package.json | ||
|
|
@@ -110,12 +123,11 @@ jobs: | |
| echo "Dry run mode, exiting successfully." | ||
| exit 0 | ||
| fi | ||
| npm dist-tag add @celo/contracts@$RELEASE_VERSION $COMMIT_HASH | ||
| # npm dist-tag add @celo/contracts@$RELEASE_VERSION $COMMIT_HASH | ||
| working-directory: packages/protocol/contracts | ||
| env: | ||
| RELEASE_TYPE: --tag ${{ env.RELEASE_TYPE != '' && env.RELEASE_TYPE || 'canary' }} | ||
| RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | ||
| NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }} | ||
| DRY_RUN: ${{ env.RELEASE_VERSION == '' && '--dry-run' || '' }} | ||
| COMMIT_HASH: ${{ env.COMMIT_HASH }} | ||
|
Comment on lines
128
to
132
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.
This change removes Useful? React with 👍 / 👎. |
||
|
|
||
|
|
@@ -128,11 +140,10 @@ jobs: | |
| echo "Dry run mode, exiting successfully." | ||
| exit 0 | ||
| fi | ||
| npm dist-tag add @celo/abis@$RELEASE_VERSION $COMMIT_HASH | ||
| # npm dist-tag add @celo/abis@$RELEASE_VERSION $COMMIT_HASH | ||
| working-directory: packages/protocol/abis | ||
| env: | ||
| RELEASE_TYPE: --tag ${{ env.RELEASE_TYPE != '' && env.RELEASE_TYPE || 'canary' }} | ||
| RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | ||
| NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }} | ||
| DRY_RUN: ${{ env.RELEASE_VERSION == '' && '--dry-run' || '' }} | ||
| COMMIT_HASH: ${{ env.COMMIT_HASH }} | ||


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.
setup-node registry-url creates .npmrc conflicting with OIDC
Medium Severity
The
actions/setup-nodestep withregistry-urlgenerates an.npmrcfile containing//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}. SinceNODE_AUTH_TOKENwas removed from the env vars, this resolves to empty, which can prevent npm from falling through to OIDC authentication — a known issue tracked inactions/setup-node#1440.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.
Fixed