-
Notifications
You must be signed in to change notification settings - Fork 5
50 lines (40 loc) · 1.15 KB
/
server_cicd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# .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:
debug: true
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/Dark-Pattern-Detection-SWDeveloperContest/server
sudo docker stop swdc-container || true
sudo docker rm swdc-container || true
sudo docker build -t swdc-app .
sudo docker run -d -p 8080:8080 --name swdc-container swdc-app