From 1a5de4f0080e90b08f96a8da04134d8529fc732f Mon Sep 17 00:00:00 2001 From: Matt Calthrop Date: Mon, 9 Dec 2024 15:40:52 +0000 Subject: [PATCH 1/2] Add use of NODE_AUTH_TOKEN when releasing --- .github/actions/get-node-version/action.yml | 4 ++-- .github/actions/prepare/action.yml | 3 +++ .github/workflows/pr.yml | 2 +- .github/workflows/release.yml | 5 ++++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/actions/get-node-version/action.yml b/.github/actions/get-node-version/action.yml index a6ca397..06d1e2f 100644 --- a/.github/actions/get-node-version/action.yml +++ b/.github/actions/get-node-version/action.yml @@ -1,5 +1,5 @@ -name: 'Get node version' -description: 'Read node version defined in package.json' +name: Get node version +description: Read node version defined in package.json outputs: value: diff --git a/.github/actions/prepare/action.yml b/.github/actions/prepare/action.yml index c1b6562..920e2f5 100644 --- a/.github/actions/prepare/action.yml +++ b/.github/actions/prepare/action.yml @@ -1,3 +1,6 @@ +name: Prepare +description: Installs dependencies + runs: using: composite steps: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d7ecaa2..eeb4779 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -2,7 +2,7 @@ name: PR validation on: pull_request: - types: [ready_for_review, opened, synchronize, reopened, push] + types: [ready_for_review, opened, synchronize, reopened, edited] branches: - main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b89684..7a52166 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,11 +18,14 @@ jobs: run: pnpm nx build nx-playwright - name: Release + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} run: | cd dist/packages/nx-playwright echo "scope=@mands" > .npmrc echo "@mands:registry=https://registry.npmjs.org/" >> .npmrc - echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc pnpm publish --access=public VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g') From 3e3ea8110a3d5f5f9964811f3a92dd0f84243edd Mon Sep 17 00:00:00 2001 From: Matt Calthrop Date: Tue, 10 Dec 2024 15:36:06 +0000 Subject: [PATCH 2/2] Tidy up scripting --- .github/workflows/release.yml | 18 ++++++++++++------ package.json | 2 +- packages/nx-playwright/package.json | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7a52166..37c8a4c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,9 @@ jobs: build: name: Build and publish runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v4.2.2 @@ -22,15 +25,18 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} run: | + set -x cd dist/packages/nx-playwright - echo "scope=@mands" > .npmrc - echo "@mands:registry=https://registry.npmjs.org/" >> .npmrc - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc + { + echo "scope=@mands" + echo "@mands:registry=https://registry.npmjs.org/" + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" + } > .npmrc pnpm publish --access=public - VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g') + VERSION=$(node --print "require('./package.json').version") echo "Tagging version $VERSION" git config user.name release-bot git config user.email release-bot@mnscorp.net - git tag -a $VERSION -m "Version ${VERSION}" - git push origin $VERSION + git tag -a "${VERSION}" -m "Version ${VERSION}" + git push origin "${VERSION}" diff --git a/package.json b/package.json index 2cbe9ff..847b08e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mands/nx-plugins", - "version": "0.7.0-beta-3", + "version": "0.7.0-beta-4", "description": "Nx plugins by M&S engineering", "license": "MIT", "private": false, diff --git a/packages/nx-playwright/package.json b/packages/nx-playwright/package.json index 74dac8b..d172b90 100644 --- a/packages/nx-playwright/package.json +++ b/packages/nx-playwright/package.json @@ -1,6 +1,6 @@ { "name": "@mands/nx-playwright", - "version": "0.7.0-beta-3", + "version": "0.7.0-beta-4", "license": "MIT", "publishConfig": { "registry": "https://registry.npmjs.org"