2021-07-17 16:30:27 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-07-17 16:35:10 +00:00
|
|
|
main
|
2021-07-17 16:30:27 +00:00
|
|
|
pull_request:
|
|
|
|
|
|
|
|
env:
|
2024-02-15 18:13:21 +00:00
|
|
|
NODE_VERSION: 20
|
2021-07-17 16:30:27 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Setup
|
|
|
|
steps:
|
2024-02-16 05:14:30 +00:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
2021-07-17 16:30:27 +00:00
|
|
|
id: node-setup
|
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_VERSION }}
|
2024-02-16 05:14:30 +00:00
|
|
|
- uses: actions/cache@v4
|
2021-07-17 16:30:27 +00:00
|
|
|
id: cache-restore
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
.yarn
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
|
|
|
|
- name: Install dependencies
|
|
|
|
if: steps.cache-restore.outputs.cache-hit != 'true'
|
2024-02-16 05:14:30 +00:00
|
|
|
run: . script/bootstrap.sh
|
2021-07-25 18:18:16 +00:00
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Lint
|
|
|
|
needs: setup
|
|
|
|
steps:
|
2024-02-16 05:14:30 +00:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
2021-07-25 18:18:16 +00:00
|
|
|
id: node-setup
|
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Yarn cache
|
2024-02-16 05:14:30 +00:00
|
|
|
uses: actions/cache@v4
|
2021-07-25 18:18:16 +00:00
|
|
|
id: yarn-cache-restore
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
.yarn
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
|
|
|
|
- name: Lint
|
|
|
|
run: |
|
2024-02-16 05:14:30 +00:00
|
|
|
. script/bootstrap.sh
|
2021-07-25 18:18:16 +00:00
|
|
|
yarn lint
|
2024-02-16 05:16:49 +00:00
|
|
|
typecheck:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Typecheck
|
|
|
|
needs: setup
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
|
|
id: node-setup
|
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Yarn cache
|
|
|
|
uses: actions/cache@v4
|
|
|
|
id: yarn-cache-restore
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
.yarn
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
|
|
|
|
- name: Lint
|
|
|
|
run: |
|
|
|
|
. script/bootstrap.sh
|
|
|
|
yarn typecheck
|
2023-06-27 17:54:34 +00:00
|
|
|
build-app:
|
2021-07-17 16:30:27 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-06-27 17:54:34 +00:00
|
|
|
name: Build App
|
2024-02-16 05:16:49 +00:00
|
|
|
needs: [typecheck, lint]
|
2021-07-17 16:30:27 +00:00
|
|
|
steps:
|
2024-02-16 05:14:30 +00:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
2021-07-17 16:30:27 +00:00
|
|
|
id: node-setup
|
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Yarn cache
|
2024-02-16 05:14:30 +00:00
|
|
|
uses: actions/cache@v4
|
2021-07-17 16:30:27 +00:00
|
|
|
id: yarn-cache-restore
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
.yarn
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
|
|
|
|
- run: |
|
2024-02-16 05:14:30 +00:00
|
|
|
. script/bootstrap.sh
|
2024-02-15 18:33:12 +00:00
|
|
|
yarn build
|
2021-07-17 16:30:27 +00:00
|
|
|
- name: Build Artifacts
|
2024-02-16 05:14:30 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2021-07-17 16:30:27 +00:00
|
|
|
with:
|
|
|
|
name: build-artifacts
|
2024-02-15 18:33:12 +00:00
|
|
|
path: dist
|
2021-07-17 16:30:27 +00:00
|
|
|
preview:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Deploy preview
|
2021-07-17 16:46:15 +00:00
|
|
|
if: ${{ github.ref != 'refs/heads/main' }}
|
2023-06-27 17:54:34 +00:00
|
|
|
needs: build-app
|
2021-07-17 16:30:27 +00:00
|
|
|
steps:
|
2024-02-16 05:14:30 +00:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
2021-07-17 16:30:27 +00:00
|
|
|
id: node-setup
|
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_VERSION }}
|
2021-07-25 18:18:16 +00:00
|
|
|
- name: Yarn cache
|
2024-02-16 05:14:30 +00:00
|
|
|
uses: actions/cache@v4
|
2021-07-25 18:18:16 +00:00
|
|
|
id: yarn-cache-restore
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
.yarn
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
|
2024-02-16 05:14:30 +00:00
|
|
|
- run: . script/bootstrap.sh
|
2021-07-17 16:30:27 +00:00
|
|
|
- name: Build Artifacts
|
2024-02-16 05:14:30 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2021-07-17 16:30:27 +00:00
|
|
|
with:
|
|
|
|
name: build-artifacts
|
2024-02-15 18:33:12 +00:00
|
|
|
path: dist
|
2021-07-17 16:30:27 +00:00
|
|
|
- name: Deploy
|
|
|
|
id: preview-deploy
|
|
|
|
env:
|
|
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
|
|
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
|
|
|
run: |
|
2024-02-15 18:33:12 +00:00
|
|
|
yarn netlify deploy --dir=dist --json | jq .deploy_url > output.log
|
2023-01-21 19:18:48 +00:00
|
|
|
echo "::set-output name=draft-url::$(cat output.log)"
|
2021-07-17 16:30:27 +00:00
|
|
|
- name: Report
|
2024-02-16 05:14:30 +00:00
|
|
|
uses: actions/github-script@v7
|
2021-07-17 16:30:27 +00:00
|
|
|
env:
|
|
|
|
DRAFT_URL: ${{ steps.preview-deploy.outputs.draft-url }}
|
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
script: |
|
2022-08-01 15:39:56 +00:00
|
|
|
github.rest.issues.createComment({
|
2021-07-17 16:30:27 +00:00
|
|
|
issue_number: context.issue.number,
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
body: `:eyes: Branch deployed at ${process.env.DRAFT_URL}`
|
|
|
|
})
|
|
|
|
deploy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Deploy
|
2023-06-27 17:54:34 +00:00
|
|
|
needs: build-app
|
2021-07-17 16:46:15 +00:00
|
|
|
if: ${{ github.ref == 'refs/heads/main' }}
|
2021-07-17 16:30:27 +00:00
|
|
|
steps:
|
2024-02-16 05:14:30 +00:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
2021-07-17 16:30:27 +00:00
|
|
|
id: node-setup
|
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_VERSION }}
|
2021-07-25 18:18:16 +00:00
|
|
|
- name: Yarn cache
|
2024-02-16 05:14:30 +00:00
|
|
|
uses: actions/cache@v4
|
2021-07-25 18:18:16 +00:00
|
|
|
id: yarn-cache-restore
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
.yarn
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
|
2024-02-16 05:14:30 +00:00
|
|
|
- run: . script/bootstrap.sh
|
2021-07-17 16:30:27 +00:00
|
|
|
- name: Build Artifacts
|
2024-02-16 05:14:30 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2021-07-17 16:30:27 +00:00
|
|
|
with:
|
|
|
|
name: build-artifacts
|
2024-02-15 18:33:12 +00:00
|
|
|
path: dist
|
2021-07-17 16:30:27 +00:00
|
|
|
- name: Netlify CLI setup
|
|
|
|
run: npm install -g netlify-cli
|
|
|
|
- name: Deploy
|
|
|
|
id: preview-deploy
|
|
|
|
env:
|
|
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
|
|
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
|
|
|
run: |
|
2024-02-15 18:33:12 +00:00
|
|
|
yarn netlify deploy --dir=dist --prod
|