Skip to content

Commit

Permalink
Merge pull request #60 from kakao-tech-campus-2nd-step3/feat/#8-ci-cd
Browse files Browse the repository at this point in the history
[Feat]#8 weekly에서 배포되도록 변경했어요
  • Loading branch information
sanghee0820 authored Oct 13, 2024
2 parents 348f9b9 + 0f5efca commit a7667cb
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ jobs:
runs-on: self-hosted

# weekly/* 브랜치에서는 실행되지 않도록 조건 추가
if: startsWith(github.ref, 'refs/heads/Master') || startsWith(github.ref, 'refs/heads/develop')
# if: startsWith(github.ref, 'refs/heads/Master') || startsWith(github.ref, 'refs/heads/develop')

# weekly/* 브랜치에서만 실행되도록
if: startsWith(github.ref, 'refs/heads/weekly/')

steps:
# 최신 이미지를 pull
Expand All @@ -76,13 +79,18 @@ jobs:
echo "${{ secrets.ENV }}" >> .env
# 브랜치에 따라 다른 환경 변수를 설정하여 컨테이너 실행
# - name: docker run new container
# run: |
# if [ "${{ github.ref }}" == "refs/heads/Master" ]; then
# sudo docker run --name inplace --rm -d -p 8080:8080 --env-file .env ${{ secrets.DOCKERHUB_USERNAME }}/inplace
# elif [ "${{ github.ref }}" == "refs/heads/develop" ]; then
# sudo docker run --name inplace-dev --rm -d -p 8081:8080 --env-file .env ${{ secrets.DOCKERHUB_USERNAME }}/inplace
# fi

# weekly/* 브랜치 8081 포트로 설정
- name: docker run new container
run: |
if [ "${{ github.ref }}" == "refs/heads/Master" ]; then
sudo docker run --name inplace --rm -d -p 8080:8080 --env-file .env ${{ secrets.DOCKERHUB_USERNAME }}/inplace
elif [ "${{ github.ref }}" == "refs/heads/develop" ]; then
sudo docker run --name inplace-dev --rm -d -p 8081:8080 --env-file .env ${{ secrets.DOCKERHUB_USERNAME }}/inplace
fi
sudo docker run --name inplace-dev --rm -d -p 8081:8080 --env-file .env ${{ secrets.DOCKERHUB_USERNAME }}/inplace
# 미사용 이미지를 정리
- name: delete old docker image
Expand Down

0 comments on commit a7667cb

Please sign in to comment.