Skip to content

Build and Deploy

Build and Deploy #91

name: Build and Deploy
on:
workflow_dispatch:
repository_dispatch:
push:
branches:
- main # only main
jobs:
build:
name: Build and Deploy
runs-on: ubuntu-latest
env:
BASIC_AUTH_USER: ${{ secrets.BASIC_AUTH_USER }}
BASIC_AUTH_PASSWORD: ${{ secrets.BASIC_AUTH_PASSWORD }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Checkout output in data repo
uses: actions/checkout@v3
with:
repository: core-curriculum/data
token: ${{ steps.app-token.outputs.token }}
path: data_in_repo
fetch-depth: 1
- name: Checkout output in json repo
uses: actions/checkout@v3
with:
repository: core-curriculum/json
token: ${{ steps.app-token.outputs.token }}
path: json_in_repo
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: "20"
- name: Compile and build
shell: bash
run: |
yarn install
yarn run build
- uses: amondnet/vercel-action@v20
with:
# GitHub Actions の Secrets で作成した値を参照する形で
# Vercel デプロイ時に必要となる各種パラメタを設定する
vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
vercel-args: "--prod" # Optional
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}} #Required
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}} #Required
working-directory: ./