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