error 해결 #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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
name: Java CI with Gradle | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# 서브 모듈 접근하기 | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.TOKEN }} | |
submodules: true | |
# 서브 모듈 변경 점 있으면 update | |
- name: Git Sumbodule Update | |
run: | | |
git submodule update --remote --recursive | |
# gradlew 권한 변경 | |
- name: Grant execute permission for gradlew | |
run : chmod +x gradlew | |
# 빌드하기 (test부분은 빌드 안함) | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | |
with: | |
arguments: clean build -x test | |
# Docker | |
- name: 도커 이미지 빌드 | |
run: docker build -t parksewoong/mssaemv2:latest . | |
- name: Docker - Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker Hub 퍼블리시 | |
run: docker push parksewoong/mssaemv2:latest | |
- name: Depoly in AWS ec2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
sudo docker stop $(sudo docker ps -a -q) | |
sudo docker rm $(sudo docker ps -a -q) | |
sudo docker pull parksewoong/mssaemv2:latest | |
sudo docker run -d -p 8080:8080 --name mssaem-server parksewoong/mssaemv2:latest |