Skip to content

Main

Main #201

Workflow file for this run

name: Main
on:
push:
tags:
- v*
pull_request:
branches: [master]
jobs:
testAndBuild:
name: 'Test and build'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://npm.pkg.github.com
always-auth: true
- name: Install dependencies
run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
- name: Install dependencies
run: yarn
- name: Lint
run: yarn lint
- name: Test
run: yarn test
env:
CI: 'true'
- name: Build
run: yarn build
- name: Upload artifacts
if: contains(github.ref, 'refs/tags/v') && matrix.node-version == '20.x'
uses: actions/upload-artifact@v1
with:
name: artifacts
path: ./dist
publishGitHub:
name: 'Publish to GitHub Packages'
runs-on: ubuntu-latest
needs: testAndBuild
if: contains(github.ref, 'refs/tags/v')
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://npm.pkg.github.com
always-auth: true
- name: Download artifacts
uses: actions/download-artifact@v1
with:
name: artifacts
path: ./dist
- name: Publish package
run: yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
publishNpm:
name: 'Publish to npm'
runs-on: ubuntu-latest
needs: testAndBuild
if: contains(github.ref, 'refs/tags/v')
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
always-auth: true
node-version: ${{ matrix.node-version }}
- name: Download artifacts
uses: actions/download-artifact@v1
with:
name: artifacts
path: ./dist
- name: Publish package
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
yarn publish --access public