Feature/seny #157
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: Front-dev build & push docker image to ghcr and deploy | |
on: | |
push: | |
branches: | |
- dev | |
- feature/deploy | |
pull_request: | |
branches: | |
- dev | |
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_DEV }} \ | |
--build-arg KAKAO_REDIRECT_URI=${{ secrets.KAKAO_REDIRECT_URI_DEV }} \ | |
--build-arg NEXT_PUBLIC_SERVER_URL=${{ secrets.NEXT_PUBLIC_SERVER_URL_DEV }} \ | |
--build-arg NEXT_PUBLIC_SELF_URL=${{ secrets.NEXT_PUBLIC_SELF_URL_DEV }} \ | |
--build-arg NEXT_PUBLIC_BASE_URL=${{ secrets.NEXT_PUBLIC_BASE_URL_DEV }} \ | |
--build-arg SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN_DEV }} \ | |
--build-arg NEXT_PUBLIC_SENTRY_DSN=${{ secrets.NEXT_PUBLIC_SENTRY_DSN_DEV }} \ | |
--build-arg NEXT_PUBLIC_KAKAOJSKEY=${{ secrets.NEXT_PUBLIC_KAKAOJSKEY_DEV }} \ | |
--build-arg NEXT_PUBLIC_GTM_ID=${{ secrets.NEXT_PUBLIC_GTM_ID }} \ | |
-t ghcr.io/topazkang/fe-dev:latest . | |
- name: Push Docker image to GHCR | |
run: docker push ghcr.io/topazkang/fe-dev:latest | |
deploy: | |
runs-on: [ self-hosted, Linux, X64, connectrip_fe ] | |
name: Deploy on Self-Hosted Runner | |
needs: build | |
steps: | |
- name: set env & deploy | |
run: | | |
cd /home/ubuntu/deploy/front | |
echo "${{ secrets.ENV_FILE_DEV }}" > .env | |
sudo sh switch.sh |