Vercel for Staging Previews #216
Workflow file for this run
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: Docs | |
defaults: | |
run: | |
working-directory: ./docs | |
# Compiles and deploys documentation on: | |
# every push that has a change in the docs folder | |
# every pull request with main branch as the base and has a change in the docs folder | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'docs/**' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'docs/**' | |
jobs: | |
docs: | |
name: Build the docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
- name: Get Yarn Cache Directory Path | |
id: cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Use Yarn Cache | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: ${{ steps.cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('./docs/yarn.lock') }} | |
- name: Installation | |
run: yarn --prefer-offline --frozen-lockfile --non-interactive | |
- name: Clean Code | |
run: yarn clean | |
- name: Build Docs | |
run: yarn build | |
# deploy to production only if the branch is main | |
- name: Deploy docs (production) | |
if: github.ref == 'refs/heads/main' | |
run: yarn run deploy:prod | |
env: | |
GITHUB_DEPLOYMENT_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |