From 1e10f4406478b15802c628e027d098132f9a6173 Mon Sep 17 00:00:00 2001 From: rookedsysc Date: Sun, 24 Mar 2024 05:10:19 +0900 Subject: [PATCH] =?UTF-8?q?deploy=20Project=20Build=EA=B0=80=20=EB=90=98?= =?UTF-8?q?=EB=8A=94=EC=A7=80=20=EA=B9=8C=EC=A7=80=EB=A7=8C=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd-wordflow.yml | 44 +++++++++---------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/.github/workflows/cd-wordflow.yml b/.github/workflows/cd-wordflow.yml index 1299200e..7284f455 100644 --- a/.github/workflows/cd-wordflow.yml +++ b/.github/workflows/cd-wordflow.yml @@ -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 \ No newline at end of file