From 59995c07f47dc39353988e98bf4c8ef5d2f89598 Mon Sep 17 00:00:00 2001 From: Guillaume Ongenae Date: Wed, 6 Dec 2023 16:20:17 +0100 Subject: [PATCH] ci(gha): fix token use during both publish --- .github/workflows/test-and-publish.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 0b2f9e53..a76ca1e5 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -68,10 +68,21 @@ jobs: name: Run Lerna version env: GH_TOKEN: ${{ secrets.PUBLIC_REPO_GHA_PAT }} + - name: Setting NPM configs to publish to NPM + run: | + echo "//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}" > .npmrc + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Publishing to NPM run: npx lerna publish from-git --yes --registry=https://registry.npmjs.org env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Setting NPM configs to publish to GitHub Packages + run: | + echo "@algoan:registry=https://npm.pkg.github.com" > .npmrc + echo "//npm.pkg.github.com/:_authToken=\${NODE_AUTH_TOKEN}" >> .npmrc + env: + NODE_AUTH_TOKEN: ${{ secrets.PUBLIC_REPO_GHA_PAT }} - name: Publishing to GitHub Packages run: npx lerna publish from-git --yes --registry=https://npm.pkg.github.com env: