Increase the version to v0.1.0-alpha.5 (#5)
#10
Workflow file for this run
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: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: "Run npm publish in dry-run mode" | |
| required: false | |
| default: "false" | |
| type: choice | |
| options: | |
| - "false" | |
| - "true" | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-publish: | |
| name: Build and Publish | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| cache: "npm" | |
| - name: Show Node and npm Versions | |
| run: | | |
| node -v | |
| npm -v | |
| - name: Install dependencies | |
| run: npm install --legacy-peer-deps | |
| - name: Run Tests | |
| run: npm test | |
| - name: Build Package | |
| run: npm run build | |
| - name: Verify Package Content | |
| run: npm pack --dry-run | |
| - name: Publish to `npm` | |
| if: >- | |
| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || | |
| (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false') | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: npm publish --access public | |
| - name: Dry-run Publish | |
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true' | |
| run: npm publish --access public --dry-run |