Reference Json Update #196
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
name: Publish reference lib package to NPM | |
on: | |
push: | |
branches: ['main'] | |
paths: ['reference-lib/**'] | |
pull_request: | |
branches: ['main'] | |
paths: ['reference-lib/**'] | |
defaults: | |
run: | |
working-directory: ./reference-lib | |
shell: bash | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: npm ci | |
- name: Test it out | |
run: npm run test | |
- name: Bundle using rollup | |
run: npm run build | |
- name: publish package | |
if: github.event_name == 'push' | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Create and push tag matching the npm package | |
if: github.event_name == 'push' | |
run: | | |
export PACKAGE_VERSION=v$(node -p -e 'require("./package.json").version') | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git tag -a "$PACKAGE_VERSION" -m "Release $PACKAGE_VERSION" | |
git push origin "$PACKAGE_VERSION" |