Skip to content

Update toit.js. (#32) #133

Update toit.js. (#32)

Update toit.js. (#32) #133

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
env:
NODE_VERSION: 15.x
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- run: yarn install
- run: yarn test
build-and-publish:
runs-on: ubuntu-latest
needs: [test]
if: github.ref == 'refs/heads/main'
strategy:
matrix:
package: [testing-utils, code-block, cookie-consent]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- run: yarn install
working-directory: packages/${{ matrix.package }}
- run: yarn build
working-directory: packages/${{ matrix.package }}
# Ideally all of the following code is handled by a GitHub action, but
# unfortunately the npm-publish action has issues when tagging the release.
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> ~/.npmrc
- uses: flood-io/is-published-on-npm@v1
id: is-published
with:
dir: packages/${{ matrix.package }}
- name: Publish new version if versions differ
if: ${{ steps.is-published.outputs.published == 'false' }}
run: yarn publish --access restricted
working-directory: packages/${{ matrix.package }}