master #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |