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: Java CI with Gradle | |
# master 브랜치에 push, PR 이벤트 발생시 동작. | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: permission | |
run: chmod +x ./gradlew | |
# Spring Boot 어플리케이션 Build (1) | |
- name: Spring Boot Build | |
run: ./gradlew clean build --exclude-task test | |
# Docker 이미지 Build (2) | |
- name: docker image build | |
run: docker build -t qlido/sinp . | |
# DockerHub Login (3) | |
- name: docker login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Docker Hub push (4) | |
- name: docker Hub push | |
run: docker push qlido/sinp | |
- name: Connect to WAS & Execute Application | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.WAS_HOST }} | |
username: ${{ secrets.WAS_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
port: ${{ secrets.WAS_SSH_PORT }} | |
script: | | |
cd /home/ubuntu/Something-Hilarious-Backend | |
docker-compose stop | |
docker-compose pull | |
docker-compose up -d |