Skip to content

Commit

Permalink
deploy Project Build가 되는지 까지만 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
rookedsysc committed Mar 23, 2024
1 parent 85707d9 commit 1e10f44
Showing 1 changed file with 13 additions and 31 deletions.
44 changes: 13 additions & 31 deletions .github/workflows/cd-wordflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,37 +30,19 @@ jobs:
distribution: "adopt"

# 세 번째 단계: GitHub secrets에서 데이터를 가져와 application.properties 파일 생성
# - name: Make application.properties
# run: |
# cd ./src/main/resources
# touch ./application.properties
# echo "${{ secrets.PROPERTIES }}" > ./application.properties
# shell: bash

# 네 번째 단계: Gradle을 사용해 프로젝트 빌드, 테스트는 제외
- name: Make application.properties
run: |
cd ./src/main/resources
touch ./application.yaml
echo "${{ secrets.APPLICATION_YAML }}" > ./application.yaml
cd ../../test/resources
touch ./application.yaml
echo "${{ secrets.APPLICATION_TEST_YAML }}" > ./application.yaml
shell: bash

# 네 번째 단계: Gradle을 사용해 프로젝트 빌드
- name: Build with Gradle
run: |
chmod +x ./gradlew
./gradlew clean build -x test
# 다섯 번째 단계: Docker 이미지를 빌드하고 Docker 저장소에 푸시
- name: Docker build & push to docker repo
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile -t ${{ secrets.DOCKER_REPO }}/directors-dev .
docker push ${{ secrets.DOCKER_REPO }}/directors-dev
# 실행주체: GitHub Actions > GitHub Infra // End

# 여섯 번째 단계: SSH를 사용하여 서버에 배포
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
envs: GITHUB_SHA
script: |
sudo docker rm -f $(docker ps -qa)
sudo docker pull ${{ secrets.DOCKER_REPO }}/directors-dev
docker-compose up -d
docker image prune -f
# ./gradlew clean build -x test
./gradlew clean build

0 comments on commit 1e10f44

Please sign in to comment.