v5.4.1 #1
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 | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| registry-url: https://registry.npmjs.org/ | |
| - name: NPM Publish | |
| run: | | |
| npm install | |
| npm run build | |
| # print the NPM user name for validation | |
| npm whoami | |
| VERSION=$(node -p "require('./package.json').version" ) | |
| # Only publish stable versions to the latest tag | |
| if [[ "$VERSION" =~ ^[^-]+$ ]]; then | |
| NPM_TAG="latest" | |
| else | |
| NPM_TAG="beta" | |
| fi | |
| echo "Publishing $VERSION with $NPM_TAG tag." | |
| npm publish --tag $NPM_TAG --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{secrets.npm_token}} | |
| CI: true |