Skip to content

🚀 Release: v1.2.0 #12

🚀 Release: v1.2.0

🚀 Release: v1.2.0 #12

name: Front-Prod build & deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: TopazKang
password: ${{ secrets.GHCR_TOKEN }}
- name: Build Docker image
run: |
docker build \
--build-arg KAKAO_API_KEY=${{ secrets.KAKAO_API_KEY_PROD }} \
--build-arg NEXT_PUBLIC_KAKAOJSKEY=${{ secrets.NEXT_PUBLIC_KAKAOJSKEY_PROD }} \
--build-arg KAKAO_REDIRECT_URI=${{ secrets.KAKAO_REDIRECT_URI_PROD }} \
--build-arg NEXT_PUBLIC_SERVER_URL=${{ secrets.NEXT_PUBLIC_SERVER_URL_PROD }} \
--build-arg NEXT_PUBLIC_SELF_URL=${{ secrets.NEXT_PUBLIC_SELF_URL_PROD }} \
--build-arg NEXT_PUBLIC_BASE_URL=${{ secrets.NEXT_PUBLIC_BASE_URL_PROD }} \
--build-arg SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN_PROD }} \
--build-arg NEXT_PUBLIC_SENTRY_DSN=${{ secrets.NEXT_PUBLIC_SENTRY_DSN_PROD }} \
--build-arg NEXT_PUBLIC_GTM_ID=${{ secrets.NEXT_PUBLIC_GTM_ID }} \
-t ghcr.io/topazkang/fe-prod:latest .
- name: Push Docker image to GHCR
run: docker push ghcr.io/topazkang/fe-prod:latest
deploy:
runs-on: [ self-hosted, Linux, X64, connectrip_fe_prod ]
name: Deploy on Self-Hosted Runner
needs: build
steps:
- name: set env & deploy
run: |
cd /home/ubuntu/front
echo "${{ secrets.ENV_FILE_PROD }}" > .env
sudo sh switch.sh