From fc7eb6ae82aef5999422dcce1bf643d36126ddf6 Mon Sep 17 00:00:00 2001 From: Nextcloud bot Date: Tue, 14 Apr 2026 16:47:42 +0000 Subject: [PATCH] ci: update npm-publish.yml workflow from template Signed-off-by: Nextcloud bot --- .github/workflows/npm-publish.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index fa93188..10495b4 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -13,24 +13,33 @@ on: types: [published] permissions: + id-token: write # Required for OIDC contents: read - packages: write jobs: publish: runs-on: ubuntu-latest name: Build and publish to npm + environment: npm-publish steps: - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false + - name: Read package.json + uses: nextcloud-libraries/parse-package-engines-action@122ae05d4257008180a514e1ddeb0c1b9d094bdd # v0.1.0 + id: versions + - name: Set up node - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 with: - node-version-file: 'package.json' + node-version: ${{ steps.versions.outputs.node-version }} + registry-url: https://registry.npmjs.org + + - name: Set up npm + run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}' - name: Check tag matches package.json run: | @@ -47,7 +56,7 @@ jobs: env: CYPRESS_INSTALL_BINARY: 0 run: | - npm ci + npm ci --ignore-scripts npm run build --if-present - name: Fetch latest tag @@ -66,8 +75,6 @@ jobs: - name: Publish run: | - npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN npm publish --tag $RELEASE_GROUP env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} RELEASE_GROUP: ${{ (contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha')) && 'next' || ((steps.latest-tag.outputs.LATEST_TAG != github.event.release.tag_name) && 'stable' || 'latest') }}