Debug #47
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: CI | |
on: | |
push: | |
branches: [main] | |
env: | |
GRAPHQL_API_URL: https://api.tsinghua.app | |
GRAPHQL_ADMIN_SECRET: ${{ secrets.GRAPHQL_ADMIN_SECRET }} | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Install pnpm | |
run: corepack enable && corepack install | |
- id: get-store-path | |
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.get-store-path.outputs.STORE_PATH }} | |
key: pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} | |
restore-keys: | | |
pnpm-store- | |
pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/.next/cache | |
key: nextjs-${{ hashFiles('pnpm-lock.yaml') }} | |
restore-keys: | | |
nextjs- | |
nextjs-${{ hashFiles('pnpm-lock.yaml') }} | |
- name: Install | |
run: pnpm install --frozen-lockfile | |
- name: Codegen | |
run: pnpm codegen | |
- name: Lint | |
run: pnpm lint | |
- name: Type Check | |
run: pnpm typecheck | |
- name: Build | |
run: pnpm build | |
deploy: | |
needs: [check] | |
runs-on: ubuntu-latest | |
env: | |
USERNAME: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CONTAINER_NAME: thursday | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login into registry | |
run: echo $GITHUB_TOKEN | docker login ghcr.io -u $USERNAME --password-stdin | |
- name: Build Docker image | |
run: docker build --build-arg GRAPHQL_API_URL=$GRAPHQL_API_URL --build-arg GRAPHQL_ADMIN_SECRET=$GRAPHQL_ADMIN_SECRET -t ghcr.io/${{ github.repository }}/$CONTAINER_NAME:latest . | |
- name: Push to registry | |
run: docker push ghcr.io/${{ github.repository }}/$CONTAINER_NAME:latest |