From b40d4462d6ee181d1b4a7677229fb19a2d07ad20 Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Sun, 29 Sep 2024 21:28:31 -0700 Subject: [PATCH] ci(github): fix release automation - add all npm registry auth tokens 1. The node-setup github action was only adding the npmjs.org registry creds. 2. Now it also adds the github package registry's credentials so that the lerna publish script can succeed. Signed-off-by: Peter Somogyvari --- .../all-nodejs-packages-publish.yaml | 66 ++++++++++++------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/.github/workflows/all-nodejs-packages-publish.yaml b/.github/workflows/all-nodejs-packages-publish.yaml index 02838b2b80..5303522601 100644 --- a/.github/workflows/all-nodejs-packages-publish.yaml +++ b/.github/workflows/all-nodejs-packages-publish.yaml @@ -5,6 +5,8 @@ env: on: push: + branches: + - "*" tags: - v* @@ -13,30 +15,46 @@ concurrency: cancel-in-progress: true jobs: - build-and-publish-packages: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4.1.7 - - run: git fetch --unshallow --prune - - uses: actions/setup-node@v4.0.3 - with: - always-auth: true - node-version: ${{ env.NODEJS_VERSION }} - registry-url: 'https://registry.npmjs.org' - - name: ./tools/ci.sh - run: ./tools/ci.sh - env: - DEV_BUILD_DISABLED: false - FULL_BUILD_DISABLED: false - JEST_TEST_RUNNER_DISABLED: true - TAPE_TEST_RUNNER_DISABLED: true - - name: lerna-publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git config --global user.email "npm-ci@hyperledger.org" - git config --global user.name "hyperledger-ghci" - npm whoami - yarn lerna publish from-git --yes --loglevel=debug --ignore-scripts + - uses: actions/checkout@v4.1.7 + - run: git fetch --unshallow --prune + - uses: actions/setup-node@v4.0.3 + with: + always-auth: true + node-version: ${{ env.NODEJS_VERSION }} + registry-url: "https://registry.npmjs.org/" + + - run: echo "FIRST REGISTRY ADDED" + - run: cat /home/runner/work/_temp/.npmrc + + - run: echo "ADDING SECOND REGISTRY" + + - uses: actions/setup-node@v4.0.3 + with: + always-auth: true + node-version: ${{ env.NODEJS_VERSION }} + registry-url: "https://npm.pkg.github.com/" + + + - run: echo "ADDED SECOND REGISTRY" + - run: cat /home/runner/work/_temp/.npmrc + + # - name: ./tools/ci.sh + # run: ./tools/ci.sh + # env: + # DEV_BUILD_DISABLED: false + # FULL_BUILD_DISABLED: false + # JEST_TEST_RUNNER_DISABLED: true + # TAPE_TEST_RUNNER_DISABLED: true + # - name: lerna-publish + # env: + # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: | + # git config --global user.email "npm-ci@hyperledger.org" + # git config --global user.name "hyperledger-ghci" + # npm whoami + # yarn lerna publish from-git --yes --loglevel=debug --ignore-scripts