Skip to content

Create main.yml

Create main.yml #1

Workflow file for this run

name: Java CI CD with Gradle
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest # 워크플로우가 Ubuntu 최선 버전에서 실행
steps:
- name: Checkout Repository
- uses: actions/checkout@v3 # 리포지토리의 코드를 체크아웃함
- name: excute remote ssh commands
uses: appleboy/ssh-action@master # ssh 연결하는 오픈 소스
with:
host: ${{ secrets.REMOTE_IP }} # 인스턴스 IP
username: ${{ secrets.REMOTE_USER }} # 우분투 ID
key: ${{ secrets.REMOTE_PRIVATE_KEY }} # EC2 인스턴스 pem key
port: ${{ secrets.REMOTE_SSH_PORT }} # 접속 포트
script: | # 실행할 스크립트
cd ./apap-back/cicd
git pull origin main
touch ./src/main/resources/application.properties # application.propreties
echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.properties
cat ./src/main/resources/application.properties
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build