Skip to content

3.1.1

3.1.1 #7

Workflow file for this run

name: Publish package
on:
push:
tags:
- 'v*.*.*'
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
get-vars:
uses: ./.github/workflows/nodevars.yml
permissions:
contents: read
build:
name: Build package
needs: get-vars
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- name: Setup node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ needs.get-vars.outputs.node-version }}
registry-url: 'https://registry.npmjs.org'
package-manager-cache: false
- name: Setup npm
run: |
if [ "$(npm --version)" != "$NPM_VERSION" ]; then
npm install -g --ignore-scripts "npm@$NPM_VERSION"
fi
test "$(npm --version)" = "$NPM_VERSION"
env:
NPM_VERSION: ${{ needs.get-vars.outputs.npm-version }}
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Pack
run: |
mkdir -p package
npm pack --ignore-scripts --pack-destination package
- name: Upload package artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: npm-package
path: package/*.tgz
if-no-files-found: error
retention-days: 7
publish:
name: Publish package
needs:
- get-vars
- build
runs-on: ubuntu-latest
permissions:
id-token: write # for npm publish --provenance
environment:
name: Publish
steps:
- name: Setup node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ needs.get-vars.outputs.node-version }}
registry-url: 'https://registry.npmjs.org'
package-manager-cache: false
- name: Setup npm
run: |
if [ "$(npm --version)" != "$NPM_VERSION" ]; then
npm install --global --ignore-scripts "npm@$NPM_VERSION"
fi
test "$(npm --version)" = "$NPM_VERSION"
env:
NPM_VERSION: ${{ needs.get-vars.outputs.npm-version }}
- name: Download package artifact
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: npm-package
path: package
- name: Publish
run: npm publish ./package/*.tgz --provenance --ignore-scripts