refactor: simplify code #33
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Build Github Pages | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
build-dist: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '18' | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn --frozen-lockfile | |
- name: Build site | |
env: | |
BASE_URL: app | |
run: | | |
yarn build | |
- name: upload dist and vercel.json | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: | | |
dist | |
vercel.json | |
deploy-to-github: | |
needs: build-dist | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Download dist | |
uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: . | |
- name: Deploy to GitHub Pages | |
uses: crazy-max/ghaction-github-pages@v3 | |
with: | |
target_branch: gh-pages | |
build_dir: dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy-to-vercel: | |
needs: build-dist | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
steps: | |
- name: Download dist | |
uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: . | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '18' | |
- name: Install Vercel CLI | |
run: yarn global add vercel | |
- name: Deploy to Vercel | |
env: | |
BASE: None | |
run: | | |
mv dist app | |
vercel --token=${{ secrets.VERCEL_TOKEN }} --prod |