Skip to content

🎨 Show lower and upper grade for each workbook (#947) #1631

🎨 Show lower and upper grade for each workbook (#947)

🎨 Show lower and upper grade for each workbook (#947) #1631

Workflow file for this run

# See:
# https://docs.github.com/en/actions/guides/building-and-testing-nodejs#building-and-testing-your-code
# https://pnpm.io/ja/continuous-integration#github-actions
# https://vercel.com/guides/how-can-i-use-github-actions-with-vercel
# https://zenn.dev/ttskch/articles/691fb62fbb6b1b
# https://vercel.com/guides/set-up-a-staging-environment-on-vercel
# https://vercel.com/docs/projects/domains/add-a-domain#verify-domain-access
# https://vercel.com/docs/cli/global-options#scope
# https://www.prisma.io/docs/orm/prisma-client/deployment/deploy-database-changes-with-prisma-migrate
# https://www.prisma.io/docs/orm/prisma-migrate/workflows/baselining
# https://github.com/pnpm/action-setup/issues/99#issuecomment-1918361558
name: CI
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
push:
branches:
- 'main'
- 'staging'
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Use corepack
run: corepack enable
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Lint
run: pnpm lint
- name: Unit test
run: pnpm test:unit
# TODO: Run integration test
# - name: Integration test
# run: pnpm test:integration
preview:
if: ${{ github.ref != 'refs/heads/main' }}
needs: build
runs-on: ubuntu-latest
environment:
name: preview
url: ${{ steps.deploy.outputs.url }}
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Use corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
check-latest: true
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Apply all pending migrations to the database
run: pnpm dlx prisma migrate deploy
env:
DATABASE_URL: ${{ secrets.PREVIEW_DATABASE_URL }}
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
id: deploy
run: echo "url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT
- name: Assign staging domain to deployment (if staging branch)
if: ${{ github.ref != 'refs/heads/main' }}
run: vercel alias set ${{ steps.deploy.outputs.url }} ${{ secrets.STAGING_DOMAIN }} --scope=${{ secrets.VERCEL_SCOPE }} --token=${{ secrets.VERCEL_TOKEN }}
production:
if: ${{ github.ref == 'refs/heads/main' }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Use corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
check-latest: true
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Apply all pending migrations to the database
run: pnpm dlx prisma migrate deploy
env:
DATABASE_URL: ${{ secrets.PRODUCTION_DATABASE_URL }}
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }}