Migrate CI to OIDC trusted publishing
This commit is contained in:
parent
fc8be2c90d
commit
018c609016
3 changed files with 36 additions and 20 deletions
22
.github/workflows/engine-publish.yml
vendored
22
.github/workflows/engine-publish.yml
vendored
|
|
@ -8,7 +8,7 @@ on:
|
|||
default: patch
|
||||
|
||||
env:
|
||||
node_version: 14
|
||||
node_version: 24
|
||||
|
||||
defaults:
|
||||
run:
|
||||
|
|
@ -17,24 +17,26 @@ defaults:
|
|||
jobs:
|
||||
version_and_release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # git push --follow-tags
|
||||
id-token: write # OIDC trusted publishing
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use Node.js ${{ env.node_version }}
|
||||
uses: actions/setup-node@v2
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.node_version }}
|
||||
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED
|
||||
# registry-url is required so npm publish targets the public npm registry
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- uses: pnpm/action-setup@v1.2.1
|
||||
with:
|
||||
version: 5.17.1
|
||||
- run: npm install -g pnpm@5.17.1
|
||||
- run: pnpm install
|
||||
- run: git config --global user.name github-actions
|
||||
- run: git config --global user.email bot@github.com
|
||||
- run: yarn config set version-git-message "Engine v%s"
|
||||
- run: yarn version --${{ github.event.inputs.newversion }}
|
||||
- run: sed -i 's:container-engine:@boardgamers/container-engine:' package.json
|
||||
- run: pnpm publish --access public --no-git-checks .
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
# pnpm 10.16+ supports OIDC trusted publishing; publish via npx so we don't have to bump
|
||||
# the repo-wide pnpm. No NODE_AUTH_TOKEN is set, so publishing authenticates with the
|
||||
# OIDC token instead of the (now-rejected) npm token.
|
||||
- run: npx -y pnpm@latest publish . --access public --no-git-checks
|
||||
- run: git push --follow-tags
|
||||
|
|
|
|||
25
.github/workflows/viewer-publish.yml
vendored
25
.github/workflows/viewer-publish.yml
vendored
|
|
@ -8,7 +8,7 @@ on:
|
|||
default: patch
|
||||
|
||||
env:
|
||||
node_version: 14
|
||||
node_version: 24
|
||||
|
||||
defaults:
|
||||
run:
|
||||
|
|
@ -17,24 +17,31 @@ defaults:
|
|||
jobs:
|
||||
version_and_release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # git push --follow-tags
|
||||
id-token: write # OIDC trusted publishing
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use Node.js ${{ env.node_version }}
|
||||
uses: actions/setup-node@v2
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.node_version }}
|
||||
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED
|
||||
# registry-url is required so npm publish targets the public npm registry
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- uses: pnpm/action-setup@v1.2.1
|
||||
with:
|
||||
version: 5.17.1
|
||||
- run: npm install -g pnpm@5.17.1
|
||||
- run: pnpm install
|
||||
- run: git config --global user.name github-actions
|
||||
- run: git config --global user.email bot@github.com
|
||||
- run: yarn config set version-git-message "Viewer v%s"
|
||||
- run: yarn version --${{ github.event.inputs.newversion }}
|
||||
- run: sed -i 's:"container-viewer":"@boardgamers/container-viewer":' package.json
|
||||
- run: pnpm publish --access public --no-git-checks .
|
||||
# pnpm 10.16+ supports OIDC trusted publishing and rewrites the workspace:../engine
|
||||
# dependency to a real version range; publish via npx so we don't have to bump the
|
||||
# repo-wide pnpm (which would force a lockfile rewrite). No NODE_AUTH_TOKEN is set, so
|
||||
# publishing authenticates with the OIDC token instead of the (now-rejected) npm token.
|
||||
# NODE_OPTIONS=--openssl-legacy-provider works around webpack 4 (vue-cli-service) relying
|
||||
# on MD4, which OpenSSL 3 (bundled with Node >= 17) no longer supports out of the box.
|
||||
- run: npx -y pnpm@latest publish . --access public --no-git-checks
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NODE_OPTIONS: --openssl-legacy-provider
|
||||
- run: git push --follow-tags
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue