Skip to content

master

master #1

Workflow file for this run

name: Publish to npm
run-name: ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
environment:
type: environment
description: Environment
required: true
permissions:
id-token: write # Required for --provenance
contents: read
packages: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: yarn
- name: Build package
run: yarn build
- name: Extract dist tag from version
id: dist_tag
run: echo "value=$(cat package.json | jq -r '.version | split("-") | .[1] // "latest" | split(".") | .[0]')" >> $GITHUB_OUTPUT
- name: Publish to npm
run: npm publish --provenance --tag ${{ steps.dist_tag.outputs.value }} --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}