[#28] fix: jar 파일 이름 변경 (#29) #11
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: dev-CD | |
on: | |
push: | |
branches: [ "develop" ] | |
jobs: | |
CI: | |
runs-on: ubuntu-22.04 | |
environment: dev | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache Gradle | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: Create secret config file | |
run: | | |
cd src/main/resources | |
echo "${{ secrets.APPLICATION_DEV }}" > ./application-dev.yml | |
- name: Build with Gradle | |
run: | | |
chmod +x gradlew | |
./gradlew clean build -x test | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Login to Docker Hub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DEV_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DEV_DOCKERHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile-dev | |
push: true | |
tags: ${{ secrets.DEV_DOCKERHUB_USERNAME }}/${{ secrets.DEV_REPONAME }}:latest | |
CD: | |
needs: [CI] | |
runs-on: ubuntu-22.04 | |
environment: dev | |
steps: | |
- name: Docker Image Pull and Run | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.DEV_SERVER_HOST }} | |
username: ${{ secrets.DEV_SERVER_USERNAME }} | |
key: ${{ secrets.DEV_SERVER_KEY }} | |
script: | | |
cd ~ | |
# 서버에서 푸시된 이미지를 pull | |
docker pull ${{ secrets.DEV_DOCKERHUB_USERNAME }}/${{ secrets.DEV_REPONAME }}:latest | |
# 무중단 배포 스크립트 | |
./deploy.sh |