Skip to content

Update README.md

Update README.md #43

Workflow file for this run

name: together-server CI/CD
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# 1. GitHub Repository Code Checkout
- name: Checkout repository
uses: actions/checkout@v2
# 2. JDK install
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
# 3. Spring Boot Project Build
- name: Build Spring Boot project
run: |
cd backend
./gradlew clean build -x test
# 4 EC2둜 jar μ—…λ‘œλ“œ
- name: Upload Jar to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
source: |
backend/build/libs/backend-0.0.1-SNAPSHOT.jar
target: ~/deploy/
strip_components: 3
# 5. EC2둜 run.sh μ—…λ‘œλ“œ
- name: Upload run.sh to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
source: |
backend/run.sh
target: ~/deploy/
strip_components: 1
# 7. EC2μ—μ„œ run.sh μ‹€ν–‰
- name: Run remote script
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd ~/deploy
chmod +x run.sh
./run.sh