Skip to content

Commit

Permalink
feat: action workflow 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
wjdtkdgns committed May 27, 2024
1 parent 534b261 commit 4f562f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/API-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: API CI
on:
push:
branches:
# - main
# - develop
# pull_request:
# branches:
# - develop
# types: [ opened, synchronize, reopened ]
- main
- develop
pull_request:
branches:
- develop
types: [ opened, synchronize, reopened ]

jobs:
build:
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/API-DEPLOY.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ name: API Deploy

on:
push:
# branches: ['main']
branches: ['main']

env:
ACTIVE_PROFILE: "prod"
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_API_SERVER_IMAGE_NAME: ${{ secrets.DOCKERHUB_API_SERVER_IMAGE_NAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}

permissions:
Expand Down Expand Up @@ -44,8 +43,8 @@ jobs:
- name: Docker build and push
run: |
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
docker build -t $DOCKERHUB_USERNAME/$DOCKERHUB_API_SERVER_IMAGE_NAME:${{env.IMAGE_TAG}} .
docker push $DOCKERHUB_USERNAME/$DOCKERHUB_API_SERVER_IMAGE_NAME:${{env.IMAGE_TAG}}
docker build -t sanghoonjeong/mania-api-server:${{env.IMAGE_TAG}} .
docker push sanghoonjeong/mania-api-server:${{env.IMAGE_TAG}}
- name: Get Public IP
id: publicip
Expand Down Expand Up @@ -73,16 +72,18 @@ jobs:
port: ${{ secrets.EC2_SSH_PORT }}
timeout: 60s
script: |
cd susu
cd joluphaja
sudo touch .env
sudo echo "${{ secrets.ENV_VARS }}" | sudo tee .env > /dev/null
sudo echo "IMAGE_TAG=${{ env.IMAGE_TAG }}" >> .env
sudo docker stop $(sudo docker ps -a -q)
sudo docker rm $(sudo docker ps -a -q)
sudo docker rmi $(sudo docker images -q)
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_API_SERVER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_NGINX_IMAGE_NAME }}:${{ secrets.DOCKERHUB_NGINX_IMAGE_TAG }}
sudo docker-compose -f ~/susu/docker-compose.yml --env-file ~/susu/.env up --build -d
sudo docker pull sanghoonjeong/mania-api-server:${{env.IMAGE_TAG}}
sudo docker pull sanghoonjeong/mania-nginx:0.0.1
sudo docker-compose -f ~/joluphaja/docker-compose.yml --env-file ~/joluphaja/.env up --build -d
sudo docker system prune --all -f
Expand Down

0 comments on commit 4f562f1

Please sign in to comment.