Publish Release v2.0.3 #7
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Release JS Library v2 | |
run-name: Publish Release ${{github.ref_name}} | |
concurrency: | |
group: ${{github.workflow}}-${{github.ref}} | |
cancel-in-progress: false | |
on: | |
push: | |
tags: | |
- "v2.[0-9]+.[0-9]+" # ex. v2.0.0 | |
- "v2.[0-9]+.[0-9]+-rc[0-9]+" # ex. v2.1.0-rc1 | |
env: | |
NEW_RELEASE_TAG: ${{github.ref_name}} | |
# Version 1.0 should NEVER be latest anymore | |
NPM_LATEST: ${{true != contains(fromJSON('["-rc", "v0.0.", "v1."]'), github.ref_name)}} | |
jobs: | |
publish-npm: | |
name: Publish NPM Package | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache-dependency-path: libraries/js/package-lock.json | |
- name: Install dependencies | |
working-directory: libraries/js | |
run: npm ci | |
- name: build | |
working-directory: libraries/js | |
run: npm run build | |
- name: Version Package | |
working-directory: libraries/js/dist | |
run: npm version --new-version "${{env.NEW_RELEASE_TAG}}" --no-git-tag-version | |
# Required for Granular Access Tokens | |
- name: NPM Access Config | |
run: npm config set //registry.npmjs.org/:_authToken ${{secrets.NPM_AUTH_TOKEN}} | |
- name: Release on NPM @latest | |
if: env.NPM_LATEST == 'true' | |
working-directory: libraries/js/dist | |
run: npm publish --tag latest --access public | |
- name: Release on NPM without @latest | |
if: env.NPM_LATEST != 'true' | |
working-directory: libraries/js/dist | |
run: npm publish --access public |