-
-
Notifications
You must be signed in to change notification settings - Fork 27
355 lines (295 loc) · 10.4 KB
/
Copy pathdevbuild.yml
File metadata and controls
355 lines (295 loc) · 10.4 KB
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
name: Continuous
on:
push:
branches:
- develop
workflow_dispatch:
inputs:
version:
description: 'Version to build (optional, defaults to branch/tag)'
required: false
type: string
jobs:
build-jar:
name: Build JAR
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: '21'
check-latest: true
cache: 'gradle'
- name: Determine version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then
VERSION="${GITHUB_REF#refs/tags/v}"
elif [ "${{ github.ref_name }}" = "main" ]; then
VERSION="$(git describe --tags --always)"
else
VERSION="${{ github.ref_name }}-$(git rev-parse --short HEAD)"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Building version: ${VERSION}"
- name: Set Permissions
run: chmod +x gradlew
- name: Build with Gradle
run: |
./gradlew clean build -Pversion=${{ steps.version.outputs.version }} \
--info --full-stacktrace --warning-mode all \
-x :serverpackcreator-api:test -x :serverpackcreator-app:test
- name: Upload JARs
uses: actions/upload-artifact@v7
with:
name: gradle-jars
path: |
serverpackcreator-api/build/libs/*.jar
serverpackcreator-app/build/libs/*.jar
serverpackcreator-plugin-example/build/libs/*.jar
retention-days: 1
build-appimage-x86_64:
name: Build AppImage (x86_64)
needs: build-jar
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Download JARs
uses: actions/download-artifact@v8
with:
name: gradle-jars
path: .
- name: Cache JDK download
uses: actions/cache@v5
with:
path: jdk-21-x86_64
key: jdk-21-x86_64
- name: Build AppImage for x86_64 (native)
run: |
chmod +x misc/build-appimage.sh
misc/build-appimage.sh "${{ needs.build-jar.outputs.version }}"
- name: Verify AppImage
run: |
APPIMAGE="ServerPackCreator-${{ needs.build-jar.outputs.version }}-x86_64.AppImage"
if [ ! -f "$APPIMAGE" ]; then
echo "❌ Error: AppImage not found: $APPIMAGE"
ls -la *.AppImage 2>/dev/null || echo "No AppImages found"
exit 1
fi
echo "✅ AppImage created successfully:"
ls -lh "$APPIMAGE"
- name: Generate checksums
run: |
APPIMAGE="ServerPackCreator-${{ needs.build-jar.outputs.version }}-x86_64.AppImage"
sha256sum "$APPIMAGE" > "$APPIMAGE.sha256"
echo "Checksum generated:"
cat "$APPIMAGE.sha256"
- name: Upload AppImage artifact
uses: actions/upload-artifact@v7
with:
name: appimage-x86_64
path: ServerPackCreator-${{ needs.build-jar.outputs.version }}-x86_64.AppImage
if-no-files-found: error
retention-days: 1
- name: Upload checksums
uses: actions/upload-artifact@v7
with:
name: appimage-x86_64-checksum
path: "*.sha256"
retention-days: 1
build-appimage-aarch64:
name: Build AppImage (aarch64)
needs: build-jar
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Download JARs
uses: actions/download-artifact@v8
with:
name: gradle-jars
path: .
- name: Cache JDK download
uses: actions/cache@v5
with:
path: jdk-21-aarch64
key: jdk-21-aarch64
- name: Build AppImage for aarch64
run: |
chmod +x misc/build-appimage.sh
misc/build-appimage.sh "${{ needs.build-jar.outputs.version }}"
- name: Verify AppImage
run: |
APPIMAGE="ServerPackCreator-${{ needs.build-jar.outputs.version }}-aarch64.AppImage"
if [ ! -f "$APPIMAGE" ]; then
echo "❌ Error: AppImage not found: $APPIMAGE"
ls -la *.AppImage 2>/dev/null || echo "No AppImages found"
exit 1
fi
echo "✅ AppImage created successfully:"
ls -lh "$APPIMAGE"
- name: Generate checksums
run: |
APPIMAGE="ServerPackCreator-${{ needs.build-jar.outputs.version }}-aarch64.AppImage"
sha256sum "$APPIMAGE" > "$APPIMAGE.sha256"
echo "Checksum generated:"
cat "$APPIMAGE.sha256"
- name: Upload AppImage artifact
uses: actions/upload-artifact@v7
with:
name: appimage-aarch64
path: ServerPackCreator-${{ needs.build-jar.outputs.version }}-aarch64.AppImage
if-no-files-found: error
retention-days: 1
- name: Upload checksums
uses: actions/upload-artifact@v7
with:
name: appimage-aarch64-checksum
path: "*.sha256"
retention-days: 1
build-media:
name: Build Install4J Media
needs: build-jar
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: '21'
check-latest: true
cache: 'gradle'
- uses: gradle/actions/setup-gradle@v6
with:
gradle-version: wrapper
- uses: luangong/setup-install4j@v1
with:
version: '12.0.2'
license: ${{ secrets.INSTALL4J_LICENSE }}
- name: Remove install4j script
run: rm install4j_linux-x64_*.sh
- name: Download JARs
uses: actions/download-artifact@v8
with:
name: gradle-jars
path: .
- name: Set Permissions
run: chmod +x gradlew
- name: Build Install4J Media
run: ./gradlew media --info --full-stacktrace
- name: Upload Media
uses: actions/upload-artifact@v7
with:
name: install4j-media
path: media/*
retention-days: 1
continuous:
name: "Continuous Pre-Release"
needs: [
build-jar,
build-appimage-x86_64,
build-appimage-aarch64,
build-media
]
runs-on: ubuntu-latest
steps:
- name: Checkout latest code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
- name: Collect files
run: |
mkdir continuous
echo "=== Collecting AppImages ==="
find artifacts/appimage-x86_64 -name "*.AppImage" -exec cp -v {} continuous/ \; 2>/dev/null || echo "No x86_64 AppImages"
find artifacts/appimage-aarch64 -name "*.AppImage" -exec cp -v {} continuous/ \; 2>/dev/null || echo "No aarch64 AppImages"
echo ""
echo "=== Collecting Checksums ==="
find artifacts -name "*.sha256" -exec cp -v {} continuous/ \; 2>/dev/null || echo "No checksums"
echo ""
echo "=== Collecting JARs ==="
find artifacts/gradle-jars -name "*.jar" ! -name "*-plain.jar" -exec cp -v {} continuous/ \; 2>/dev/null || echo "No JARs"
echo ""
echo "=== Collecting Install4J Media ==="
cp artifacts/install4j-media/*.dmg continuous/ 2>/dev/null || echo "No DMG files"
cp artifacts/install4j-media/*.sh continuous/ 2>/dev/null || echo "No SH files"
cp artifacts/install4j-media/*.exe continuous/ 2>/dev/null || echo "No EXE files"
echo ""
echo "=== Final Contents ==="
ls -lh continuous/
- name: Generate checksum
uses: jmgilman/actions-generate-checksum@v1
with:
patterns: |
continuous/*
- name: Collect checksum
run: cp checksum.txt continuous/
- name: Update develop tag
uses: richardsimko/update-tag@v2
with:
tag_name: continuous
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get build timestamp
id: build_time
run: echo "timestamp=$(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
- name: Create/Update Release
uses: ncipollo/release-action@v1
with:
allowUpdates: 'true'
artifacts: "continuous/*"
body: |
## 🔄 Continuous Dev-Build
**Built:** ${{ steps.build_time.outputs.timestamp }}
**Commit:** `${{ github.sha }}`
---
This is an automated development build, updated every time changes are pushed to `develop`.
⚠️ **Warning:** Do not use unless you have been told to, or are curious about the contents of the dev build.
🚫 **Do not link to this release.**
commit: "develop"
name: "continuous"
prerelease: 'true'
removeArtifacts: 'true'
replacesArtifacts: 'true'
tag: 'continuous'
- name: Get source archives
run: |
wget -O continuous/source.zip https://github.com/Griefed/ServerPackCreator/archive/refs/tags/continuous.zip
wget -O continuous/source.tar.gz https://github.com/Griefed/ServerPackCreator/archive/refs/tags/continuous.tar.gz
- name: Cleanup continuous on server
uses: tiyee/action-ssh@v1.0.1
with:
host: ${{ secrets.SPCUPLOAD_HOST }}
username: ${{ secrets.SPCUPLOAD_USERNAME }}
privateKey: ${{ secrets.SPCUPLOAD_KEY }}
command: 'rm -rf ~/spc/continuous'
- name: Upload to server
uses: nogsantos/scp-deploy@master
with:
src: ./continuous
host: ${{ secrets.SPCUPLOAD_HOST }}
remote: "${{ secrets.SPCUPLOAD_TARGET }}"
user: ${{ secrets.SPCUPLOAD_USERNAME }}
key: ${{ secrets.SPCUPLOAD_KEY }}