Release #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |