Merge pull request #318 from sparksuite/dependabot/npm_and_yarn/word-… #176
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: Main CI | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
- v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+ | |
- v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+ | |
- v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+ | |
pull_request: | |
branches: | |
- master | |
jobs: | |
lint: | |
name: Lint code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v3 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- run: yarn dev | |
- run: yarn lint | |
test: | |
name: Run tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [lts/*, current] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v3 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- run: yarn dev | |
- run: yarn test | |
- name: Codecov | |
uses: codecov/codecov-action@v3 | |
verify-website: | |
name: Verify website | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v3 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- run: yarn dev | |
- run: yarn --cwd ./website type-check | |
- run: yarn --cwd ./website build | |
publish: | |
name: Publish to npm | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- test | |
- verify-website | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
registry-url: 'https://registry.npmjs.org' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v3 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- run: yarn dev | |
- run: yarn publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
deploy: | |
name: Deploy to GitHub Pages | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- test | |
- verify-website | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
registry-url: 'https://registry.npmjs.org' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v3 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- run: yarn dev | |
- run: yarn --cwd ./website build | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: website/build |