2021-03-03 04:53:13 -07:00
|
|
|
name: Build Documentation
|
|
|
|
|
|
|
|
on:
|
2021-03-03 05:17:34 -07:00
|
|
|
pull_request:
|
2021-03-04 02:28:51 -07:00
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
- '.github/workflows/build-docs.yml'
|
|
|
|
- 'docs/**'
|
2021-03-09 01:45:06 -07:00
|
|
|
- 'src/**'
|
2021-03-04 02:28:51 -07:00
|
|
|
- '*.json'
|
2021-03-09 01:45:06 -07:00
|
|
|
- '*.js'
|
|
|
|
- '*.lock'
|
2021-03-03 04:53:13 -07:00
|
|
|
push:
|
2021-03-04 02:28:51 -07:00
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
- '.github/workflows/build-docs.yml'
|
|
|
|
- 'docs/**'
|
2021-03-09 01:45:06 -07:00
|
|
|
- 'src/**'
|
2021-03-04 02:28:51 -07:00
|
|
|
- '*.json'
|
2021-03-09 01:45:06 -07:00
|
|
|
- '*.js'
|
|
|
|
- '*.lock'
|
2021-03-03 04:53:13 -07:00
|
|
|
|
|
|
|
jobs:
|
2021-03-03 05:17:34 -07:00
|
|
|
checks:
|
|
|
|
if: github.event_name != 'push'
|
2021-03-09 06:16:21 -07:00
|
|
|
name: Build Documentation
|
2021-03-03 05:17:34 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-03-09 06:16:21 -07:00
|
|
|
- uses: actions/checkout@v2
|
2021-03-04 02:27:37 -07:00
|
|
|
|
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
|
2021-03-04 02:36:27 -07:00
|
|
|
- name: Test Docs Build
|
2021-03-03 05:17:34 -07:00
|
|
|
run: |
|
2021-03-04 02:38:42 -07:00
|
|
|
yarn install --frozen-lockfile
|
2021-03-04 02:36:27 -07:00
|
|
|
cd docs
|
2021-03-03 05:17:34 -07:00
|
|
|
yarn install --frozen-lockfile
|
2021-03-04 02:27:37 -07:00
|
|
|
yarn build
|
2021-03-03 04:53:13 -07:00
|
|
|
gh-release:
|
2021-03-03 05:17:34 -07:00
|
|
|
if: github.event_name != 'pull_request'
|
2021-03-09 06:16:21 -07:00
|
|
|
name: Deploy Documentation
|
2021-03-03 04:53:13 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-03-09 06:16:21 -07:00
|
|
|
- uses: actions/checkout@v2
|
2021-03-09 06:14:54 -07:00
|
|
|
|
|
|
|
- name: Add key to allow access to repository
|
|
|
|
env:
|
|
|
|
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.ssh
|
|
|
|
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
|
|
|
echo "${{ secrets.GH_PAGES_DEPLOY }}" > ~/.ssh/id_rsa
|
|
|
|
chmod 600 ~/.ssh/id_rsa
|
|
|
|
cat <<EOT >> ~/.ssh/config
|
|
|
|
Host github.com
|
|
|
|
HostName github.com
|
|
|
|
IdentityFile ~/.ssh/id_rsa
|
|
|
|
EOT
|
2021-03-04 02:27:37 -07:00
|
|
|
|
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
2021-03-08 09:51:47 -07:00
|
|
|
- name: Restore node_modules from cache
|
|
|
|
uses: actions/cache@v2
|
2021-03-04 02:27:37 -07:00
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
|
2021-03-03 04:53:13 -07:00
|
|
|
- name: Release to GitHub Pages
|
|
|
|
env:
|
2021-03-09 06:14:52 -07:00
|
|
|
USE_SSH: true
|
2021-03-09 06:14:54 -07:00
|
|
|
GIT_USER: git
|
2021-03-03 05:17:34 -07:00
|
|
|
CURRENT_BRANCH: main
|
|
|
|
DEPLOYMENT_BRANCH: gh-pages
|
2021-03-03 05:29:35 -07:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2021-03-03 04:53:13 -07:00
|
|
|
run: |
|
2021-03-09 06:14:54 -07:00
|
|
|
git config --global user.email "actions@github.com"
|
|
|
|
git config --global user.name "gh-actions"
|
2021-03-03 13:31:22 -07:00
|
|
|
yarn install --frozen-lockfile
|
2021-03-03 04:53:13 -07:00
|
|
|
cd docs
|
|
|
|
yarn install --frozen-lockfile
|
2021-03-03 05:03:29 -07:00
|
|
|
yarn deploy
|