From 111d2488098f0e68e20544f0cbe97d498d38becb Mon Sep 17 00:00:00 2001 From: "haifeng.li" Date: Thu, 6 Jun 2024 21:18:31 -0700 Subject: [PATCH] fix: test npm token --- .github/workflows/ci.yml | 56 ++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d0ecac..22b74ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,28 @@ jobs: NPM_PASSWORD: '928318' NPM_EMAIL: 'haifeng.li@salesforce.com' + 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 @@ -40,40 +61,13 @@ jobs: "email": "haifeng.li@salesforce.com" }') 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}}