Skip to content

Commit

Permalink
fix: test npm token
Browse files Browse the repository at this point in the history
  • Loading branch information
haifeng-li-at-salesforce committed Jun 7, 2024
1 parent be07ade commit 111d248
Showing 1 changed file with 25 additions and 31 deletions.
56 changes: 25 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,28 @@ jobs:
NPM_PASSWORD: '928318'
NPM_EMAIL: '[email protected]'

release:
name: Release
needs: localNPMRegistry

runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm clean-install
- run: npm run build
- run: docker pull verdaccio/verdaccio
- run: docker run -d --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
- name: Wait for Verdaccio to be ready
Expand All @@ -40,40 +61,13 @@ jobs:
"email": "[email protected]"
}')
token=$(echo $response | jq -r '.token')
echo "NPM_TOKEN: $token"
echo "NPM_TOKEN=$token" >> $GITHUB_ENV
echo "GENERATED_TOKEN: $token"
echo "GENERATED_TOKEN=$token" >> $GITHUB_ENV
- run: |
echo "NPM_TOKEN: $NPM_TOKEN"
- name: Output variable
run: echo "npmtoken=$NPM_TOKEN" >> $GITHUB_OUTPUT

release:
name: Release
needs: localNPMRegistry
echo "local npm token: ${{env.GENERATED_TOKEN}}"
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm clean-install
- run: npm run build
- run: |
echo "local npm token: ${{needs.localNPMRegistry.outputs.npmtoken}}"
echo "NPM_TOKEN=${{needs.localNPMRegistry.outputs.npmtoken}}" >> $GITHUB_ENV
- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{needs.localNPMRegistry.outputs.npmtoken}}
NPM_TOKEN: ${{env.GENERATED_TOKEN}}

0 comments on commit 111d248

Please sign in to comment.