-
Notifications
You must be signed in to change notification settings - Fork 0
377 lines (365 loc) · 16.7 KB
/
release.yml
File metadata and controls
377 lines (365 loc) · 16.7 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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
name: Release
on:
workflow_dispatch:
inputs:
tag:
description: "Release tag (e.g., 2.0.0)"
required: true
draft:
description: "Create release as draft"
required: false
default: "true"
prerelease:
description: "Mark release as prerelease"
required: false
default: "false"
permissions:
contents: write
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "21"
- name: Build Linux bundle + JVM jars
run: ./gradlew :lwjgl3:bundleLinuxTar :lwjgl3:jarLinux :core:pluginApiJar -PreleaseNumber="${{ inputs.tag }}"
- uses: actions/upload-artifact@v4
with:
name: octodraw-linux
path: |
dist/*.tar.gz
lwjgl3/build/libs/*.jar
core/build/libs/octodraw-plugin*.jar
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "21"
- name: Build Windows bundle
run: .\\gradlew.bat :lwjgl3:bundleWin -PreleaseNumber="${{ inputs.tag }}"
- name: Build MSI (Windows)
shell: powershell
run: |
$ErrorActionPreference = "Stop"
$version = "${{ inputs.tag }}"
$appName = "Octodraw"
$displayName = "Octodraw 3D"
$publisher = "CN=K3D0"
$packageName = "com.github.alfu32.octodraw"
$jarDir = "lwjgl3\build\libs"
$jarPath = Join-Path $jarDir "octodraw-$version.jar"
$jpackage = Join-Path $env:JAVA_HOME "bin\jpackage.exe"
if (!(Test-Path $jarPath)) { throw "Jar not found: $jarPath" }
& $jpackage --type app-image --name $appName --app-version $version --vendor "alfu32" --win-console `
--input $jarDir --main-jar "octodraw-$version.jar" --dest "dist\jpackage" `
--icon "lwjgl3\icons\logo.ico" `
--java-options "-Xms512m" --java-options "-Xmx6g"
$appImage = "dist\jpackage\$appName"
$pluginsDir = Join-Path $appImage "app\\plugins"
$tutorialsDir = Join-Path $appImage "app\\tutorials"
New-Item $pluginsDir -ItemType Directory -Force | Out-Null
New-Item $tutorialsDir -ItemType Directory -Force | Out-Null
Copy-Item "core\build\libs\octodraw-plugin-api*.jar" $pluginsDir -Force
Copy-Item "scripts\*.groovy" $pluginsDir -Force
Copy-Item "docs\tutorial\*" $tutorialsDir -Recurse -Force
& $jpackage --type msi --name $appName --app-version $version --vendor "alfu32" `
--app-image $appImage --dest "dist\installer" `
--icon "lwjgl3\icons\logo.ico" --win-per-user-install --win-menu --win-shortcut
- name: Prepare MSIX layout
shell: powershell
run: |
$ErrorActionPreference = "Stop"
$version = "${{ inputs.tag }}"
$appName = "Octodraw"
# Must match the reserved Microsoft Store app name exactly.
$displayName = "OctoDraw-Free"
$publisher = "CN=7F0CBC95-8035-4AF2-9B17-C38D58351CE5"
$publisherDisplayName = "K3D0"
# Must match the product identity configured in Partner Center exactly.
$packageName = "K3D0.OctoDraw-Free"
$appImage = "dist\jpackage\$appName"
$msixRoot = "dist\msix"
if (Test-Path $msixRoot) { Remove-Item $msixRoot -Recurse -Force }
New-Item $msixRoot -ItemType Directory -Force | Out-Null
Copy-Item -Path (Join-Path $appImage "*") -Destination $msixRoot -Recurse -Force
$assetsDir = Join-Path $msixRoot "Assets"
New-Item $assetsDir -ItemType Directory -Force | Out-Null
Copy-Item "assets\appicon.png" (Join-Path $assetsDir "Square150x150Logo.png")
Copy-Item "assets\appicon.png" (Join-Path $assetsDir "Square44x44Logo.png")
Copy-Item "assets\appicon.png" (Join-Path $assetsDir "StoreLogo.png")
$baseNames = @("Square150x150Logo", "Square44x44Logo", "StoreLogo")
foreach ($name in $baseNames) {
$scaled = Join-Path $assetsDir ("{0}.scale-100.png" -f $name)
$base = Join-Path $assetsDir ("{0}.png" -f $name)
if ((Test-Path $scaled) -and !(Test-Path $base)) {
Copy-Item $scaled $base -Force
}
}
$manifest = @(
'<?xml version="1.0" encoding="utf-8"?>',
'<Package',
' xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"',
' xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"',
' xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"',
' xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"',
' xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"',
' IgnorableNamespaces="uap uap3 desktop rescap">',
' <Identity Name="__PACKAGE_NAME__" Publisher="__PUBLISHER__" Version="__VERSION__.0" />',
' <Properties>',
' <DisplayName>__DISPLAY_NAME__</DisplayName>',
' <PublisherDisplayName>__PUBLISHER_DISPLAY_NAME__</PublisherDisplayName>',
' <Logo>Source\Assets\StoreLogo.png</Logo>',
' </Properties>',
' <Resources>',
' <Resource Language="en-us" />',
' </Resources>',
' <Dependencies>',
' <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.22621.0" />',
' </Dependencies>',
' <Applications>',
' <Application Id="Octodraw" Executable="Source/__APP_NAME__.exe" EntryPoint="Windows.FullTrustApplication">',
' <uap:VisualElements DisplayName="__DISPLAY_NAME__" Description="__DISPLAY_NAME__"',
' Square150x150Logo="Source\Assets\Square150x150Logo.png"',
' Square44x44Logo="Source\Assets\Square44x44Logo.png"',
' BackgroundColor="transparent" />',
' <Extensions>',
' <uap:Extension Category="windows.fileTypeAssociation">',
' <uap:FileTypeAssociation Name="octd">',
' <uap:SupportedFileTypes>',
' <uap:FileType>.octd</uap:FileType>',
' </uap:SupportedFileTypes>',
' </uap:FileTypeAssociation>',
' </uap:Extension>',
' <uap3:Extension Category="windows.appExecutionAlias" Executable="Source\__APP_NAME__.exe" EntryPoint="Windows.FullTrustApplication">',
' <uap3:AppExecutionAlias>',
' <desktop:ExecutionAlias Alias="octodraw.exe" />',
' </uap3:AppExecutionAlias>',
' </uap3:Extension>',
' </Extensions>',
' </Application>',
' </Applications>',
' <Capabilities>',
' <rescap:Capability Name="runFullTrust" />',
' </Capabilities>',
'</Package>'
) -join "`n"
$manifest = $manifest.Replace("__PACKAGE_NAME__", $packageName)
$manifest = $manifest.Replace("__PUBLISHER__", $publisher)
$manifest = $manifest.Replace("__PUBLISHER_DISPLAY_NAME__", $publisherDisplayName)
$manifest = $manifest.Replace("__VERSION__", $version)
$manifest = $manifest.Replace("__DISPLAY_NAME__", $displayName)
$exe = Get-ChildItem $msixRoot -Filter *.exe | Select-Object -First 1
if ($null -eq $exe) { throw "No executable found in $msixRoot" }
$manifest = $manifest.Replace("__APP_NAME__", $exe.BaseName)
$manifestPath = Join-Path $msixRoot "AppxManifest.xml"
$manifest | Out-File -Encoding utf8 $manifestPath
- name: Debug MSIX layout
shell: powershell
run: |
$ErrorActionPreference = "Stop"
Write-Host "MSIX staging root:"
Get-ChildItem -Path dist\\msix -Recurse | ForEach-Object {
if ($_.PSIsContainer) {
Write-Host ("[DIR] " + $_.FullName)
} else {
Write-Host ("[FILE] " + $_.FullName)
}
}
Write-Host "Executables found:"
Get-ChildItem -Path dist\\msix -Recurse -Filter *.exe | ForEach-Object { Write-Host $_.FullName }
- name: Build MSIX (Windows)
id: msix-build
uses: BHznJNs/msix-build@v0.9
with:
app-build-path: dist/msix/.
appx-manifest-path: dist/msix/AppxManifest.xml
icon-path: assets/appsplash.png
priconfig-path: scripts/priconfig.xml
- name: Sign MSIX (Windows)
shell: powershell
env:
K3D_PFX_B64: ${{ secrets.K3D_PFX_B64 }}
K3D_PFX_PASSWORD: ${{ secrets.K3D_PFX_PASSWORD }}
run: |
$ErrorActionPreference = "Stop"
Write-Host "Runner time (UTC):"
Get-Date -Format o
$msixPath = "${{ steps.msix-build.outputs.msix-path }}"
if ([string]::IsNullOrWhiteSpace($msixPath) -or !(Test-Path $msixPath)) {
throw "MSIX not found: $msixPath"
}
if ([string]::IsNullOrWhiteSpace($env:K3D_PFX_B64)) { throw "K3D_PFX_B64 secret is empty" }
if ([string]::IsNullOrWhiteSpace($env:K3D_PFX_PASSWORD)) { throw "K3D_PFX_PASSWORD secret is empty" }
$pfxPath = Join-Path $env:RUNNER_TEMP "k3d-sign.pfx"
[IO.File]::WriteAllBytes($pfxPath, [Convert]::FromBase64String($env:K3D_PFX_B64))
$signtool = Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin" -Recurse -Filter signtool.exe |
Sort-Object FullName -Descending | Select-Object -First 1
if ($null -eq $signtool) { throw "signtool.exe not found (Windows SDK required)" }
& $signtool.FullName sign /fd SHA256 /f $pfxPath /p $env:K3D_PFX_PASSWORD /tr http://timestamp.digicert.com /td SHA256 $msixPath
$msiPath = Join-Path "dist\installer" ("octodraw-${{ inputs.tag }}.msi")
if (Test-Path $msiPath) {
& $signtool.FullName sign /fd SHA256 /f $pfxPath /p $env:K3D_PFX_PASSWORD /tr http://timestamp.digicert.com /td SHA256 $msiPath
}
- name: Debug MSIX build workspace
shell: powershell
run: |
$ErrorActionPreference = "Stop"
$workspace = $env:WORKING_DIRECTORY
Write-Host "WORKING_DIRECTORY=$workspace"
if (![string]::IsNullOrWhiteSpace($workspace) -and (Test-Path $workspace)) {
Write-Host "Listing WORKING_DIRECTORY contents:"
Get-ChildItem -Path $workspace -Recurse | ForEach-Object {
if ($_.PSIsContainer) {
Write-Host ("[DIR] " + $_.FullName)
} else {
Write-Host ("[FILE] " + $_.FullName)
}
}
} else {
Write-Host "WORKING_DIRECTORY does not exist"
}
if (Test-Path "D:\\a\\_temp\\msix-build") {
Write-Host "Listing D:\\a\\_temp\\msix-build contents:"
Get-ChildItem -Path "D:\\a\\_temp\\msix-build" -Recurse | ForEach-Object {
if ($_.PSIsContainer) {
Write-Host ("[DIR] " + $_.FullName)
} else {
Write-Host ("[FILE] " + $_.FullName)
}
}
} else {
Write-Host "D:\\a\\_temp\\msix-build does not exist"
}
if (Test-Path "D:\\a\\_temp\\msix-build\\Source") {
Write-Host "Listing D:\\a\\_temp\\msix-build\\Source contents:"
Get-ChildItem -Path "D:\\a\\_temp\\msix-build\\Source" -Recurse | ForEach-Object {
if ($_.PSIsContainer) {
Write-Host ("[DIR] " + $_.FullName)
} else {
Write-Host ("[FILE] " + $_.FullName)
}
}
} else {
Write-Host "D:\\a\\_temp\\msix-build\\Source does not exist"
}
- name: Collect MSIX (Windows)
shell: powershell
run: |
$ErrorActionPreference = "Stop"
$outputPath = "${{ steps.msix-build.outputs.msix-path }}"
if ([string]::IsNullOrWhiteSpace($outputPath)) { throw "MSIX output path missing" }
New-Item "dist\\installer" -ItemType Directory -Force | Out-Null
Copy-Item $outputPath "dist\\installer\\octodraw-${{ inputs.tag }}.msix" -Force
- uses: actions/upload-artifact@v4
with:
name: octodraw-windows
path: |
dist/*.zip
dist/installer/*.msi
dist/installer/*.msix
build-mac:
runs-on: macos-14
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "21"
- name: Build macOS bundle (arm64)
run: ./gradlew :lwjgl3:bundleMacArm64Tar -PreleaseNumber="${{ inputs.tag }}"
- uses: actions/upload-artifact@v4
with:
name: octodraw-mac
path: dist/*.tar.gz
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "21"
- uses: android-actions/setup-android@v3
- name: Install Android SDK components
run: |
sdkmanager "platforms;android-36" "build-tools;36.0.0"
- name: Prepare Android signing keystore
env:
ANDROID_UPLOAD_KEYSTORE_B64: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_B64 }}
ANDROID_UPLOAD_STORE_PASSWORD: ${{ secrets.ANDROID_UPLOAD_STORE_PASSWORD }}
ANDROID_UPLOAD_KEY_ALIAS: ${{ secrets.ANDROID_UPLOAD_KEY_ALIAS }}
ANDROID_UPLOAD_KEY_PASSWORD: ${{ secrets.ANDROID_UPLOAD_KEY_PASSWORD }}
run: |
set -euo pipefail
if [ -z "${ANDROID_UPLOAD_KEYSTORE_B64:-}" ] || [ -z "${ANDROID_UPLOAD_STORE_PASSWORD:-}" ] || [ -z "${ANDROID_UPLOAD_KEY_ALIAS:-}" ] || [ -z "${ANDROID_UPLOAD_KEY_PASSWORD:-}" ]; then
echo "Missing Android signing secrets. Required: ANDROID_UPLOAD_KEYSTORE_B64, ANDROID_UPLOAD_STORE_PASSWORD, ANDROID_UPLOAD_KEY_ALIAS, ANDROID_UPLOAD_KEY_PASSWORD"
exit 1
fi
keystore_path="$RUNNER_TEMP/octodraw-upload.jks"
echo "$ANDROID_UPLOAD_KEYSTORE_B64" | base64 --decode > "$keystore_path"
chmod 600 "$keystore_path"
{
echo "ANDROID_UPLOAD_STORE_FILE=$keystore_path"
echo "ANDROID_UPLOAD_STORE_PASSWORD=$ANDROID_UPLOAD_STORE_PASSWORD"
echo "ANDROID_UPLOAD_KEY_ALIAS=$ANDROID_UPLOAD_KEY_ALIAS"
echo "ANDROID_UPLOAD_KEY_PASSWORD=$ANDROID_UPLOAD_KEY_PASSWORD"
} >> "$GITHUB_ENV"
- name: Build Android APK + AAB bundles
run: |
./gradlew :android:bundleAndroidApk :android:bundleAndroidAab -PreleaseNumber="${{ inputs.tag }}"
- uses: actions/upload-artifact@v4
with:
name: octodraw-android
path: |
dist/octodraw-*.apk
dist/octodraw-*.aab
build-web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "21"
- name: Build web bundles
run: ./gradlew :web:bundleWeb :web:bundleWebComponentZip -PreleaseNumber="${{ inputs.tag }}"
- uses: actions/upload-artifact@v4
with:
name: octodraw-web
path: |
dist/octodraw-*-webapp.zip
dist/octodraw-*-webcomponent.zip
release:
runs-on: ubuntu-latest
needs: [build-linux, build-windows, build-mac, build-android, build-web]
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create or update release assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
TAG: ${{ inputs.tag }}
DRAFT: ${{ inputs.draft }}
PRERELEASE: ${{ inputs.prerelease }}
run: |
set -euo pipefail
if ! gh release view "$TAG" >/dev/null 2>&1; then
gh release create "$TAG" --draft="$DRAFT" --prerelease="$PRERELEASE"
else
gh release edit "$TAG" --draft="$DRAFT" --prerelease="$PRERELEASE"
fi
files=$(find artifacts -type f \( -name "*.zip" -o -name "*.tar.gz" -o -name "*.snap" -o -name "*.jar" -o -name "*.msi" -o -name "*.msix" -o -name "*.apk" -o -name "*.aab" \))
if [ -z "$files" ]; then
echo "No release artifacts found."
exit 1
fi
gh release upload "$TAG" $files --clobber