[FEAT] 유저 부분 주석 추가 (#97) #7
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
# Workflow 이름 | |
name: Spring Boot & Gradle CI/CD | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# JDK 17 설치 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# application.yml파일을 생성 | |
- name: make application.yml | |
run: | | |
mkdir ./src/main/resources/secret | |
cd ./src/main/resources/secret | |
touch ./application-aws.yml | |
echo "${{ secrets.APPLICATION_AWS_YML }}" >> ./application-aws.yml | |
touch ./application-dev-db.yml | |
echo "${{ secrets.APPLICATION_DEV_YML }}" >> ./application-dev-db.yml | |
touch ./application-jwt.yml | |
echo "${{ secrets.APPLICATION_JWT_YML }}" >> ./application-local-jwt.yml | |
shell: bash | |
# gradlew에 실행 권한을 부여 | |
- name: Grant execute permisson for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle (without Test) | |
run: ./gradlew clean build -x test --stacktrace | |
- name: Docker Hub build & push | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} . | |
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest | |
# EC2에 접속하고 배포 | |
- name: Deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.EC2_KEY }} | |
port: ${{ secrets.EC2_SSH_PORT }} | |
script: | | |
sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
sudo docker rm -f $(sudo docker ps -qa) | |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} | |
sudo docker-compose up -d | |
sudo docker image prune -f |