Skip to content

Commit

Permalink
feat: 프론트엔드 ci / cd를 위한 github actions 스크립트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
pricelees committed Jul 24, 2024
1 parent 702c5a7 commit be3f54f
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/cd-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: frontend-deploy

on:
push:
branches:
- develop-frontend

jobs:
deploy:
runs-on: self-hosted

steps:
- name: Log in to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: allow ubuntu to access actions-runner
run: |
sudo chown -R ubuntu:ubuntu ~/actions-runner
- name: grant permission to docker-compose
run: |
sudo chmod +x ./frontend/docker-compose-fe.yml
- name: docker compose down
run: |
docker compose -f ./frontend/docker-compose-fe.yml down
- name: docker compose pull
run: |
docker compose -f ~/frontend/docker-compose-fe.yml pull
- name: docker compose up
run: |
docker compose -f ~/frontend/docker-compose-fe.yml up -d
49 changes: 49 additions & 0 deletions .github/workflows/ci-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: frontend-integration

on:
pull_request:
branches:
- develop-frontend

jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
shell: bash
working-directory: ./frontend

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: develop-frontend

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.15.0'

- name: Create .env file
run: |
echo "BASE_URL=${{ secrets.BASE_URL }}" > .env
- name: Install Dependencies
run: npm install --frozen-lockfile

- name: Build static file
run: npm run build

- name: Build Docker image
run: |
docker buildx build ./ --platform=linux/arm64 -t ${{ secrets.DOCKER_USERNAME }}/mouda-fe:latest
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push Docker image to DockerHub
run: docker push ${{ secrets.DOCKER_USERNAME }}/mouda-fe:latest

0 comments on commit be3f54f

Please sign in to comment.