Skip to content

Update server_cicd.yml #43

Update server_cicd.yml

Update server_cicd.yml #43

Workflow file for this run

# .github/workflows/ci-cd.yml
name: server CI/CD Pipeline
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Gradle
uses: gradle/gradle-build-action@v3
with:
gradle-version: '8.8'
- name: Build with Gradle
run: |
cd server
./gradlew build -x test
- name: Deploy to GCP VM
if: success()
uses: appleboy/ssh-action@v0.1.3
with:
host: ${{ secrets.GCP_SERVER_VM_HOST }}
username: ${{ secrets.GCP_SERVER_VM_USER }}
key: ${{ secrets.GCP_SERVER_SSH_PRIVATE_KEY }}
port: 22
script: |
cd /home/patturning1/deployment
pkill -15 -f swdc-0.0.1-SNAPSHOT.jar
rm -rf /home/patturning1/deployment/*
scp -r ./server/build/libs/* patturning1@34.47.71.246:/home/patturning1/deployment/
nohup java -jar swdc-0.0.1-SNAPSHOT.jar &