Skip to content

Workflow file for this run

on: push
name: "Build, Test & Deploy 🚀"
jobs:
build:
if: "!contains(github.event.head_commit.message, 'no-ci')"
name: Build Lib
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v3
with:
node-version: 16.14.2
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: Install Dependencies
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn install --pure-lockfile
- name: Check library builds
run: yarn build
- name: Check tests build
run: yarn tsc-test
- name: Check tests pass
run: yarn test
- name: Upload lib build artifact
uses: actions/upload-artifact@v3
with:
name: build-lib
path: dist
deploy:
if: "!contains(github.event.head_commit.message, 'no-deploy-lib')"
needs: build
name: Deploy Library
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v3
with:
node-version: 16.14.2
- uses: actions/cache@v3
id: cache-modules
with:
path: node_modules
key: ${{ runner.OS }}-deploy-${{ hashFiles('package.json') }}
- name: Download build-lib
uses: actions/download-artifact@v3
with:
name: build-lib
path: dist
- name: Fix git error
run: git config --global --add safe.directory "/github/workspace"
- name: Deploy to npm! 🚀 (if master branch)
if: github.ref == 'refs/heads/master'
uses: mikeal/merge-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
demo:
needs: build
name: Deploy Demo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v3
with:
node-version: 16.14.2
- uses: actions/cache@v3
id: cache-modules
with:
path: src-demo/node_modules
key: ${{ runner.OS }}-demo-${{ hashFiles('src-demo/package.json') }}
- name: Install Dependencies
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn install
working-directory: ./src-demo
- run: REACT_APP_FIREBASE_CONFIG="${{ secrets.FIREBASE_JSON }}" yarn build-ci
working-directory: ./src-demo
- name: Deploy to GH Pages 🚀
if: github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: src-demo/build # The folder the action should deploy.