Version 4.0.0-beta.2 #2
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 Package to npmjs | |
on: | |
release: | |
types: [published] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: ⬇️ Check out code | |
uses: actions/checkout@v4 | |
- name: Setup .npmrc file to publish to npm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Build and Publish | |
run: | | |
npm ci | |
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 |