-
Notifications
You must be signed in to change notification settings - Fork 0
216 lines (183 loc) · 6.99 KB
/
Copy pathrelease.yml
File metadata and controls
216 lines (183 loc) · 6.99 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
name: Release
on:
workflow_dispatch:
inputs:
changelog:
description: 'Changelog for this release'
required: true
default: 'Minor updates and fixes'
version:
description: 'Version tag (e.g. v1.0.0)'
required: true
default: 'v1.0.0'
jobs:
desktop:
name: Desktop ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel, ubuntu-24.04-arm]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Dependencies (Linux)
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y libgles2-mesa-dev libvulkan-dev glslang-tools
- name: Install Dependencies (macOS)
if: contains(matrix.os, 'macos')
run: brew install glslang
- name: Install Vulkan SDK (Windows)
if: contains(matrix.os, 'windows')
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
function Find-VulkanSdkDir {
$patterns = @(
'C:\VulkanSDK\*',
'C:\Program Files\VulkanSDK\*',
"$env:USERPROFILE\VulkanSDK\*"
)
foreach ($pattern in $patterns) {
$dir = Get-ChildItem -Path $pattern -Directory -ErrorAction SilentlyContinue |
Sort-Object Name -Descending | Select-Object -First 1
if ($dir) { return $dir.FullName }
}
return $null
}
$installed = $false
try {
winget install --id KhronosGroup.VulkanSDK --accept-package-agreements --accept-source-agreements --disable-interactivity
if ($LASTEXITCODE -eq 0) { $installed = $true }
} catch {
Write-Host "winget install failed: $($_.Exception.Message)"
}
if (-not $installed) {
choco install vulkan-sdk -y
}
$sdkDir = Find-VulkanSdkDir
if (-not $sdkDir) { throw "Vulkan SDK not found after installation." }
Write-Host "Using Vulkan SDK: $sdkDir"
"VULKAN_SDK=$sdkDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
(Join-Path $sdkDir 'Bin') | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install glslang (Windows)
if: contains(matrix.os, 'windows')
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$headers = @{
"Accept" = "application/vnd.github+json"
"X-GitHub-Api-Version" = "2022-11-28"
}
function Get-GlslangAssetUrl {
param([string]$Tag)
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/KhronosGroup/glslang/releases/tags/$Tag" -Headers $headers
$asset = $release.assets | Where-Object { $_.name -match 'windows.*Release\.zip$' } | Select-Object -First 1
if ($asset) { return $asset.browser_download_url }
return $null
}
$assetUrl = $null
foreach ($tag in @("main-tot", "master-tot")) {
try {
$assetUrl = Get-GlslangAssetUrl -Tag $tag
if ($assetUrl) {
Write-Host "Using glslang release tag: $tag"
break
}
} catch {
Write-Host "Tag $tag lookup failed: $($_.Exception.Message)"
}
}
if (-not $assetUrl) { throw "Unable to locate a Windows glslang asset from main-tot/master-tot." }
$zipPath = Join-Path $env:RUNNER_TEMP "glslang-windows.zip"
$extractDir = Join-Path $env:RUNNER_TEMP "glslang"
if (Test-Path $extractDir) { Remove-Item -Recurse -Force $extractDir }
Invoke-WebRequest -Uri $assetUrl -OutFile $zipPath
Expand-Archive -Path $zipPath -DestinationPath $extractDir -Force
$validator = Get-ChildItem -Path $extractDir -Recurse -File -Filter glslangValidator.exe -ErrorAction SilentlyContinue | Select-Object -First 1
$glslang = Get-ChildItem -Path $extractDir -Recurse -File -Filter glslang.exe -ErrorAction SilentlyContinue | Select-Object -First 1
$tool = if ($validator) { $validator } elseif ($glslang) { $glslang } else { $null }
if (-not $tool) { throw "glslang executable not found in downloaded asset." }
$toolDir = Split-Path -Parent $tool.FullName
Write-Host "Using glslang tool: $($tool.FullName)"
$toolDir | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
& $tool.FullName --version
- name: Build Desktop (Require Vulkan on windows-x64/linux-x64)
if: matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest'
env:
LIVE2D_REQUIRE_VULKAN: "ON"
run: python3 scripts/build.py desktop
- name: Build Desktop
if: matrix.os != 'windows-latest' && matrix.os != 'ubuntu-latest'
run: python3 scripts/build.py desktop
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: live2d-desktop-${{ matrix.os }}
path: out/*.jar
android:
name: Android Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Setup Android NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r26b
- name: Install Vulkan Shader Compiler
run: |
sudo apt-get update
sudo apt-get install -y glslang-tools
- name: Build Android
run: python3 scripts/build.py android
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: live2d-android
path: out/*.jar
publish:
needs: [desktop, android]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: all-jars
- name: Prepare Release Assets
run: |
mkdir assets
find all-jars -name "*.jar" -exec cp {} assets/ \;
ls -R assets
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.version }}
name: Release ${{ github.event.inputs.version }}
body: ${{ github.event.inputs.changelog }}
files: assets/*.jar
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}