fix: API 버그 수정 (#60) #43
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 production | |
env: | |
VERSION: 0.0.1 | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main, 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 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
cache: 'gradle' | |
- name: Gradle Caching | |
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: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: Build JAR | |
run: ./gradlew bootJar -Dspring.profiles.active=prod | |
- name: Login to DockerHub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and Push | |
uses: docker/[email protected] | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: | |
${{ secrets.DOCKERHUB_REPOSITORY }}:${{ env.VERSION }} | |
- name: Deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.AWS_HOST }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.AWS_SSH_KEY }} | |
script: | | |
cd bin/bash | |
sudo sh deploy.sh |