refactor:문제 생성 반환값 변경,문제 정렬 #105
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: CI/CD with Node.js and Docker | |
on: | |
push: | |
branches: | |
- main # 원하는 브랜치로 변경 가능 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
token: ${{ secrets.GH_DOTCOM_TOKEN }} | |
node-version: '18' # 사용할 Node.js 버전을 선택합니다 | |
- name: Cache yarn dependencies | |
uses: actions/cache@v2 | |
with: | |
path: .yarn/cache | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install --immutable --immutable-cache --check-cache | |
- name: Build Node.js app | |
run: yarn run build | |
- name: Build Docker image | |
run: docker buildx build . --no-cache | |
- name: Log in to Docker Hub | |
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: yisuho/mjat-server:latest | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: SSH connect to production server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: | | |
cd server | |
docker rmi $(docker images -f "dangling=true" -q) | |
docker-compose down | |
docker-compose pull | |
docker-compose up --force-recreate --build -d |