react-native-vision-camera/.github/workflows/build-docs.yml

96 lines
2.6 KiB
YAML
Raw Normal View History

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'
- 'src/**'
- 'docs/**'
- '*.js'
- '*.json'
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'
- 'src/**'
- 'docs/**'
- '*.js'
- '*.json'
2021-03-03 04:53:13 -07:00
jobs:
2021-03-03 05:17:34 -07:00
checks:
if: github.event_name != 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '12.x'
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-03 04:53:13 -07:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
2021-03-03 04:53:13 -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)"
- 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-03 06:45:57 -07:00
USE_SSH: true
2021-03-03 04:53:13 -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-03 05:22:40 -07:00
git config --global user.email "actions@github.com"
2021-03-03 04:53:13 -07:00
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