hotfix: 템플릿 삭제 요청 포맷 변경 #75
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: Deploy to develop | |
on: | |
push: | |
branches: [ develop ] | |
jobs: | |
ci-cd: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.SUBMODULE_SCOPED_TOKEN }} | |
submodules: true | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Install redis | |
run: sudo apt-get install -y redis-tools redis-server | |
- name: Verify that redis is up | |
run: redis-cli ping | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: Build JAR | |
run: ./gradlew bootJar -Dspring.profiles.active=dev | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and Push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
file: ./Dockerfile | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }}:dev | |
- name: Send docker-compose.yml | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.NCP_HOST }} | |
username: ${{ secrets.NCP_USERNAME }} | |
password: ${{ secrets.NCP_PASSWORD }} | |
port: 22 | |
source: "./docker-compose.yml" | |
target: "/root" | |
- name: Send deploy.sh | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.NCP_HOST }} | |
username: ${{ secrets.NCP_USERNAME }} | |
password: ${{ secrets.NCP_PASSWORD }} | |
port: 22 | |
source: "./script/deploy.sh" | |
target: "/root" | |
strip_components: 2 | |
- name: Deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.NCP_HOST }} | |
username: ${{ secrets.NCP_USERNAME }} | |
password: ${{ secrets.NCP_PASSWORD }} | |
script: | | |
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }}:dev | |
sudo chmod 777 ./deploy.sh | |
sudo ./deploy.sh | |
sudo docker image prune -af |