Skip to content

Merge pull request #1 from MOJAN3543/main #12

Merge pull request #1 from MOJAN3543/main

Merge pull request #1 from MOJAN3543/main #12

Workflow file for this run

name: CI
env:
DOCKER_IMAGE: ghcr.io/likelion-knu04/mealog-web
DOCKER_CONTAINER: mealog-web
on:
push:
branches: ['main']
pull_request:
types: [opened, synchronize]
jobs:
build:
name: Build and Test
timeout-minutes: 15
runs-on: ubuntu-latest
# To use Remote Caching, uncomment the next lines and follow the steps below.
# env:
# TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
# TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: Install dependencies
run: yarn
- name: Build
run: yarn build
push:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: |
image=moby/buildkit:v0.10.6
- name: login to ghcr
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Create environment file
run: |
echo DATABASE_URL=${{ secrets.DATABASE_URL }} >> ./.env
echo DATABASE_URL=${{ secrets.DATABASE_URL }} >> ./apps/web/.env.production
echo GOOGLE_AUTH_CLIENT_ID=${{ secrets.GOOGLE_AUTH_CLIENT_ID }} >> ./apps/web/.env.production
echo GOOGLE_AUTH_CLIENT_SECRET=${{ secrets.GOOGLE_AUTH_CLIENT_SECRET }} >> ./apps/web/.env.production
echo KAKAO_AUTH_CLIENT_ID=${{ secrets.KAKAO_AUTH_CLIENT_ID }} >> ./apps/web/.env.production
echo KAKAO_AUTH_CLIENT_SECRET=${{ secrets.KAKAO_AUTH_CLIENT_SECRET }} >> ./apps/web/.env.production
echo NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }} >> ./apps/web/.env.production
echo NEXTAUTH_URL=${{ secrets.NEXTAUTH_URL }} >> ./apps/web/.env.production
echo AI_API_URL=${{ secrets.AI_API_URL }} >> ./apps/web/.env.production
echo FIREBASE_API_KEY=${{ secrets.FIREBASE_API_KEY }} >> ./apps/web/.env.production
echo FIREBASE_AUTH_DOMAIN=${{ secrets.FIREBASE_AUTH_DOMAIN }} >> ./apps/web/.env.production
echo FIREBASE_PROJECT_ID=${{ secrets.FIREBASE_PROJECT_ID }} >> ./apps/web/.env.production
echo FIREBASE_STORAGE_BUCKET=${{ secrets.FIREBASE_STORAGE_BUCKET }} >> ./apps/web/.env.production
echo FIREBASE_MESSAGING_SENDER_ID=${{ secrets.FIREBASE_MESSAGING_SENDER_ID }} >> ./apps/web/.env.production
echo FIREBASE_APP_ID=${{ secrets.FIREBASE_APP_ID }} >> ./apps/web/.env.production
echo FIREBASE_MEASUREMENT_ID=${{ secrets.FIREBASE_MEASUREMENT_ID }} >> ./apps/web/.env.production
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
file: ./apps/web/Dockerfile
push: true
tags: ${{ env.DOCKER_IMAGE }}:latest
platforms: |
linux/amd64
linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max