-
Notifications
You must be signed in to change notification settings - Fork 14
140 lines (126 loc) · 4.89 KB
/
gradle.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Allay
on:
push:
branches: [ "master" ]
paths:
- .github/workflows/gradle.yml
- gradle/libs.versions.toml
- api/**
- server/**
- data/**
pull_request:
paths:
- .github/workflows/gradle.yml
- gradle/libs.versions.toml
- api/**
- server/**
- data/**
jobs:
build:
runs-on: ubuntu-latest
steps:
# Support for ipv6
- name: Setup WARP
uses: fscarmen/[email protected]
if: contains(github.ref_name, 'master')
with:
stack: dual
- uses: actions/checkout@v4
- run: chmod +x gradlew
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'zulu'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: wrapper
cache-overwrite-existing: true
cache-read-only: false
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"
- name: Build
run: ./gradlew build
- name: Generate coverage reports
if: success()
run: ./gradlew jacocoTestReport
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
if: success()
with:
directory: .jacoco/test/
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
if: success()
with:
name: allay-server
path: server/build/libs/allay-server-*-shaded.jar
- name: Publish to JitPack
uses: fjogeleit/http-request-action@v1
if: success() && github.event_name == 'push' && github.repository == 'AllayMC/Allay' && contains(github.ref_name, 'master')
with:
url: 'https://jitpack.io/#AllayMC/Allay/master-SNAPSHOT'
method: 'GET'
# - name: Get Short SHA
# id: vars
# if: success()
# run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
#
# - name: Format ChangeLog
# id: get-changelog
# if: success() && github.event_name == 'push' && github.repository == 'AllayMC/Allay' && contains(github.ref_name, 'master')
# run: |
# CHANGELOG=$(echo "${{ github.event.commits[0].message }}" | sed ':a;N;$!ba;s/\n/\\n/g')
# echo "changelog=$CHANGELOG" >> $GITHUB_OUTPUT
#
# - name: Get Time
# id: time
# uses: nanzm/[email protected]
# if: success() && github.event_name == 'push' && github.repository == 'AllayMC/Allay' && contains(github.ref_name, 'master')
# with:
# timeZone: 8
# format: 'YYYY/MM/DD-HH:mm:ss'
#
# - name: Publish to MineBBS
# uses: fjogeleit/http-request-action@v1
# if: success() && github.event_name == 'push' && github.repository == 'AllayMC/Allay' && contains(github.ref_name, 'master')
# with:
# url: 'https://api.minebbs.com/api/openapi/v1/resources/8815/update'
# method: 'POST'
# customHeaders: '{"Authorization": "Bearer ${{ secrets.MINEBBS_API_KEY }}"}'
# contentType: 'application/json'
# data: '{"title": "${{ github.ref_name }}-${{ steps.vars.outputs.sha_short }}", "description": "${{ steps.get-changelog.outputs.changelog }}", "new_version": "${{ steps.time.outputs.time }}", "file_url": "https://github.com/AllayMC/Allay"}'
# escapeData: 'true'
# preventFailureOnNoResponse: 'true'
# ignoreStatusCodes: '400,404,401,403,429,500,502,503,504'
- name: Copy Jar to Test Server
id: deploy-jar
uses: appleboy/scp-action@master
if: success() && github.event_name == 'push' && github.repository == 'AllayMC/Allay' && contains(github.ref_name, 'master')
continue-on-error: true
with:
host: ${{ secrets.TEST_SERVER_HOST }}
username: ${{ secrets.TEST_SERVER_USER_NAME }}
port: ${{ secrets.TEST_SERVER_PORT }}
key: ${{ secrets.TEST_SERVER_SSH_KEY }}
passphrase: ${{ secrets.TEST_SERVER_SSH_KEY_PASSPHRASE }}
source: "server/build/libs/allay-server-*-shaded.jar"
strip_components: 3
target: "/root/allaymc/tmp"
- name: Restart Test Server
uses: appleboy/ssh-action@master
if: steps.deploy-jar.outcome == 'success' && github.event_name == 'push' && github.repository == 'AllayMC/Allay' && contains(github.ref_name, 'master')
continue-on-error: true
with:
host: ${{ secrets.TEST_SERVER_HOST }}
username: ${{ secrets.TEST_SERVER_USER_NAME }}
key: ${{ secrets.TEST_SERVER_SSH_KEY }}
passphrase: ${{ secrets.TEST_SERVER_SSH_KEY_PASSPHRASE }}
port: ${{ secrets.TEST_SERVER_PORT }}
command_timeout: 60s
script: |
cd /root/allaymc
./restart.sh
exit