Skip to content

Version 5.1.0-beta.1 #44

Version 5.1.0-beta.1

Version 5.1.0-beta.1 #44

Workflow file for this run

name: Publish
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Build and Test
run: |
npm install
npm run build
npm run test
env:
CI: true
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: NPM Publish
run: |
npm install
npm run build
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
# 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 --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
CI: true