Skip to content

Commit

Permalink
ci: retrieve the registry secret from a variable in matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
ebr committed Jan 26, 2024
1 parent b00feca commit 499a23b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ permissions:

jobs:
build:
# allow failure publishing to npm for now
# TODO: remove this once we have a token
continue-on-error: ${{ matrix.registry.url == 'https://registry.npmjs.org' }}
strategy:
matrix:
registry:
# - url: https://registry.npmjs.org
# token: ${{ secrets.NPM_TOKEN }}
- url: https://registry.npmjs.org
token_secret: NPM_TOKEN
- url: https://npm.pkg.github.com
token: ${{ secrets.GITHUB_TOKEN }}
token_secret: GITHUB_TOKEN
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -41,8 +44,7 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
env:
# NODE_AUTH_TOKEN: ${{ matrix.registry.token }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets[matrix.registry.token_secret] }}

- name: Version bump
# only if manual workflow dispatch and not on a tag
Expand All @@ -58,4 +60,4 @@ jobs:
fi
pnpm publish --access public --no-git-checks $FLAGS
env:
NODE_AUTH_TOKEN: ${{ matrix.registry.token }}
NODE_AUTH_TOKEN: ${{ secrets[matrix.registry.token_secret] }}

0 comments on commit 499a23b

Please sign in to comment.