-
Notifications
You must be signed in to change notification settings - Fork 2
73 lines (62 loc) · 1.83 KB
/
cd.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: CD with Gradle
on:
push:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- uses: mirromutth/[email protected]
with:
host port: 3306
container port: 3306
mysql database: 'appcenter'
mysql user: 'root'
mysql password: ${{ secrets.MYSQL_PWD }}
- name: Download application YML
run: |
mkdir -p src/main/resources
echo "${{ secrets.APPLICATION_YML }}" | base64 --decode > src/main/resources/application.yml
find src
- name: Download SQL
run: |
mkdir -p src/main/resources
echo "${{ secrets.DATA_SQL }}" | base64 --decode > src/main/resources/data.sql
find src
- name: Gradle build
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: build -x test
- name: Upload Jacoco report
uses: actions/upload-artifact@v3
with:
name: index
path: build/jacocoHTML
- name: SCP files to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
password: ${{ secrets.SERVER_PWD }}
port: 22
source: "./build/libs/*.jar"
target: /home/serverking/appcenter-homepage
- name: Execute script via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
password: ${{ secrets.SERVER_PWD }}
port: 22
script_stop: true
script: |
cd /home/serverking/appcenter-homepage
sh deploy.sh