mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-21 06:32:16 +03:00
fix(ci): reference NPM_TOKEN environment for environment-scoped secrets (#18)
Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
15ec100dcb
commit
c4cdb52fe6
16
.github/workflows/npm-publish.yml
vendored
16
.github/workflows/npm-publish.yml
vendored
@@ -11,6 +11,7 @@ permissions:
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
environment: NPM_TOKEN
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -35,18 +36,7 @@ jobs:
|
||||
npm version "$VERSION" --no-git-tag-version --allow-same-version
|
||||
echo "Publishing version: $VERSION"
|
||||
|
||||
- name: Configure npm auth
|
||||
run: |
|
||||
TOKEN="${NPM_TOKEN_SECRET:-$NPM_TOKEN_VAR}"
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo "❌ NPM_TOKEN not found in secrets or vars"
|
||||
exit 1
|
||||
fi
|
||||
echo "//registry.npmjs.org/:_authToken=${TOKEN}" > ~/.npmrc
|
||||
echo "✅ npm auth configured"
|
||||
env:
|
||||
NPM_TOKEN_SECRET: ${{ secrets.NPM_TOKEN }}
|
||||
NPM_TOKEN_VAR: ${{ vars.NPM_TOKEN }}
|
||||
|
||||
- name: Publish to npm
|
||||
run: npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user