Skip to content

Bump version

Bump version #106

Workflow file for this run

name: CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches:
- master
pull_request:
branches:
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
name: 'Build & Test'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup cache
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies if no cache wasn't found
run: yarn --frozen-lockfile
- name: Build
run: yarn run build
- name: Run Tests
run: yarn test
- name: Upload artifacts for publishing
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
publish:
name: Publish to NPM registry if version changed
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if version has been updated
id: check
uses: EndBug/version-check@v2
- name: Download dist artifact
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Publish
if: ${{ github.ref == 'refs/heads/master' && steps.check.outputs.changed == 'true' }}
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_AUTH_TOKEN}
npm publish --ignore-scripts
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}