v3.3.14 #176
Workflow file for this run
This file contains 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
# Publish Package to NPM | |
--- | |
name: Publish Package to NPM | |
on: | |
release: | |
types: [published] | |
pull_request: | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
name: Build and Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
# npm token | |
cache: "npm" | |
- run: npm ci | |
- run: npm run lint | |
- run: npm run build | |
- run: npm run tsc | |
publish: | |
name: Publish to NPM | |
needs: build | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'release' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org | |
- run: npm ci | |
- run: npm run build | |
- run: npm run tsc | |
# check if package.json version matches release tag | |
- run: | | |
result="v$(jq -r .version package.json)" | |
if [ "$result" != "${{ github.event.release.tag_name }}" ]; then | |
echo "package.json version does not match release tag" | |
exit 1 | |
fi | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |