async api document에서 enum이 스키마를 참조하는 않는 문제 수정 (#44) #28
This file contains hidden or 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: backend-dev | |
on: | |
push: | |
branches: ['main'] | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push (latest tag only) | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: | | |
ghcr.io/modern-agile-team/quizz-game-io-backend:latest | |
deploy: | |
needs: build-and-push | |
runs-on: [self-hosted, homelab] | |
permissions: | |
contents: read | |
packages: read | |
steps: | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Pull latest and resolve digest | |
id: resolve | |
run: | | |
set -e | |
IMAGE=ghcr.io/modern-agile-team/quizz-game-io-backend:latest | |
docker pull "$IMAGE" | |
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' "$IMAGE") | |
echo "image=$DIGEST" >> "$GITHUB_OUTPUT" | |
- name: Run Prisma migrate using digest | |
run: | | |
docker run --rm \ | |
--network quizzes_game_io_backend_default \ | |
--env-file /home/github-runner/app/.env \ | |
"${{ steps.resolve.outputs.image }}" \ | |
npx prisma migrate deploy | |
- name: Update app container using same digest | |
env: | |
NAME: quizzes_game_io_backend_app | |
ENV_FILE: /home/github-runner/app/.env | |
run: | | |
docker rm -f "$NAME" || true | |
docker run -d \ | |
--name "$NAME" \ | |
--restart unless-stopped \ | |
--env-file "$ENV_FILE" \ | |
--network quizzes_game_io_backend_default \ | |
-p 127.0.0.1:8080:8080 \ | |
"${{ steps.resolve.outputs.image }}" |