Merge pull request #1 from TeskaLabs/refactor/github-workflow #5
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: Build with Yarn and push to NPM repository | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.10.0] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: "https://registry.npmjs.org/" | |
always-auth: true | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build library | |
run: yarn build | |
- name: Publish to npm | |
if: startsWith(github.ref, 'refs/tags/') # Runs only when a tag is pushed | |
run: | | |
yarn publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_TOKEN }} |