Feature/62 : 즐겨찾기 목록 조회 응답 필드 추가 #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Daily Phrase Dev API CI/CD | |
on: | |
pull_request: | |
branches: | |
- develop | |
types: | |
- closed | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Create application.yml | |
run: | | |
mkdir -p ./src/main/resources/ | |
echo "${{ secrets.APPLICATION_YML }}" > ./src/main/resources/application.yml | |
- name: Grant execute permission for Gradlew | |
run: chmod +x ./gradlew | |
- name: Build with Gradle | |
run: ./gradlew build -x test -Pprofile=dev | |
- name: Log in to NCP Container Registry | |
run: docker login -u ${{ secrets.NCP_USERNAME }} -p ${{ secrets.NCP_PASSWORD }} ${{ secrets.NCP_REGISTRY_URL }} | |
- name: Build Docker image | |
run: docker build -t ${{ secrets.NCP_REGISTRY_URL }}/${{ secrets.NCP_PROJECT_NAME }}:${{ github.sha }} . | |
- name: Push Docker image to NCP Container Registry | |
run: docker push ${{ secrets.NCP_REGISTRY_URL }}/${{ secrets.NCP_PROJECT_NAME }}:${{ github.sha }} | |
- name: Deploy to NCP Server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.NCP_SERVER_HOST }} | |
username: ${{ secrets.NCP_SERVER_USERNAME }} | |
password: ${{ secrets.NCP_SERVER_SSH_PASSWORD }} | |
port: 22 | |
script: | | |
docker pull ${{ secrets.NCP_REGISTRY_URL }}/${{ secrets.NCP_PROJECT_NAME }}:${{ github.sha }} | |
docker stop dailyphrase-dev-api || true | |
docker rm dailyphrase-dev-api || true | |
docker run -d --name dailyphrase-dev-api -p 80:8080 ${{ secrets.NCP_REGISTRY_URL }}/${{ secrets.NCP_PROJECT_NAME }}:${{ github.sha }} |