Publish to npm #10
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 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "npm dist-tag to publish under" | |
| type: choice | |
| default: latest | |
| options: | |
| - latest | |
| - next | |
| - beta | |
| dry_run: | |
| description: "Dry run (build and pack, but do not publish)" | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: read | |
| id-token: write | |
| concurrency: | |
| group: publish-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| publish: | |
| name: Publish to npm | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| registry-url: "https://registry.npmjs.org" | |
| cache: npm | |
| - run: npm ci --ignore-scripts | |
| - run: npm run typecheck | |
| - run: npm run build | |
| - name: Verify expected publish artifacts exist | |
| run: test -f dist/index.js && test -f dist/holo-cards.css && test -f dist-types/index.d.ts | |
| - name: Publish | |
| run: npm publish --provenance --access public --tag "${{ inputs.tag }}" ${{ inputs.dry_run && '--dry-run' || '' }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |