From 00a1b8b073db16dcb0bec08b87611cbb8f563165 Mon Sep 17 00:00:00 2001 From: Nextcloud bot Date: Tue, 27 Jul 2021 06:22:04 +0000 Subject: [PATCH] Updating npm-publish.yml workflow from template Signed-off-by: Nextcloud bot --- .github/workflows/npm-publish.yml | 41 ++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 9ad9ce4..632919c 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,3 +1,8 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization + name: Publish on: @@ -5,30 +10,42 @@ on: types: [published] jobs: - build: + publish: runs-on: ubuntu-latest - strategy: - matrix: - node-versions: [12.x] - - name: node${{ matrix.node-versions }} + name: Build and publish to npm steps: - - uses: actions/checkout@v2 + - name: Check actor permission level + uses: skjnldsv/check-actor-permission@v2 + with: + require: admin + + - name: Checkout + uses: actions/checkout@v2 - - name: Set up node ${{ matrix.node-versions }} - uses: actions/setup-node@v1 + - name: Read package.json node and npm engines version + uses: skjnldsv/read-package-engines-version-actions@v1.1 + id: versions with: - node-versions: ${{ matrix.node-versions }} + fallbackNode: '^12' + fallbackNpm: '^6' + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@v2 + with: + node-version: ${{ steps.versions.outputs.nodeVersion }} + + - name: Set up npm ${{ steps.versions.outputs.npmVersion }} + run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" - name: Install dependencies & build run: | npm ci npm run build --if-present - - name: Publish to npm + - name: Publish run: | npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN npm publish env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}