v1.0.5 (#69) #179
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: Node.js CI | |
### github.ref | |
# tags refs/tags/v0.0.1 | |
# master refs/heads/master | |
on: [push, pull_request] | |
jobs: | |
####### Print: Prints some context relating to the job to make future debugging easier | |
print: | |
name: Print context | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Print context 🎉 | |
env: | |
GH_REF: ${{ github.ref }} | |
run: | | |
echo "GH_REF: ${GH_REF}" | |
####### Lint | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- run: yarn prep | |
- run: yarn lint | |
####### Unit tests | |
unit_tests: | |
name: 'Unit tests' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- run: yarn prep | |
- run: yarn test | |
####### Publish to npm | |
npm_publish: | |
name: Publish to npm | |
runs-on: ubuntu-latest | |
needs: [lint, unit_tests] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
registry-url: https://registry.npmjs.org/ | |
- name: yarn publish | |
env: | |
IS_ALPHA: ${{ contains(github.ref, 'alpha')}} | |
IS_BETA: ${{ contains(github.ref, 'beta')}} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
if [ ${IS_ALPHA} = true ]; then export NPM_TAG="--tag alpha"; fi | |
if [ ${IS_BETA} = true ]; then export NPM_TAG="--tag beta"; fi | |
yarn prep | |
yarn publish --access=public ${NPM_TAG} |