refactor(ci): unify build environment initialization
Gitea CI / Check code and tests (pull_request) Successful in 6m19s
Gitea CI / Build Windows x64 app (pull_request) Successful in 3m12s
Gitea CI / Build Android APK (pull_request) Successful in 3m39s
Gitea CI / Audit and package Windows x64 (pull_request) Successful in 1m4s
Gitea CI / Assemble and validate CI artifacts (pull_request) Successful in 50s
Gitea CI / Gitea CI passed (pull_request) Successful in 2s

This commit is contained in:
lingjhf committed 2026-10-06 17:58:03 +08:00
1 parent da98df00a8
commit 5a0ffa513c
4 files changed
+92 -46

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
name: Prepare Flutter build environment
description: Configure persistent caches, verify Flutter and resolve locked dependencies.
inputs:
flutter-version:
description: Required Flutter framework version
required: true
configure-java:
description: Configure Flutter to use the runner's JAVA_HOME
default: 'false'
runs:
using: composite
steps:
- name: Configure persistent build caches
shell: pwsh
run: ./tool/gitea/prepare-build-cache.ps1
- name: Verify Flutter version
shell: pwsh
env:
REQUIRED_FLUTTER_VERSION: ${{ inputs.flutter-version }}
run: |
$ErrorActionPreference = 'Stop'
$output = flutter --version --machine
if ($LASTEXITCODE -ne 0) { throw 'Cannot read Flutter version.' }
$version = $output | ConvertFrom-Json
if ($version.frameworkVersion -ne $env:REQUIRED_FLUTTER_VERSION) {
throw "Flutter $env:REQUIRED_FLUTTER_VERSION required; found $($version.frameworkVersion)."
}
- name: Configure Flutter Java
if: ${{ inputs.configure-java == 'true' }}
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
if (-not $env:JAVA_HOME) { throw 'JAVA_HOME is required for Flutter JDK setup.' }
flutter config --jdk-dir=$env:JAVA_HOME
if ($LASTEXITCODE -ne 0) { throw 'Flutter JDK setup failed.' }
- name: Resolve locked Flutter dependencies
shell: pwsh
run: |
flutter pub get --enforce-lockfile
if ($LASTEXITCODE -ne 0) { throw 'Locked Flutter dependency resolution failed.' }
@@ -0,0 +1,20 @@
name: Prepare Windows packaging environment
description: Reuse the user .NET installation and pinned packaging tools independently of Flutter.
runs:
using: composite
steps:
- name: Configure user .NET installation
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$directory = Join-Path $env:LOCALAPPDATA 'Cutdex/ci-tools/dotnet'
[IO.Directory]::CreateDirectory($directory) | Out-Null
"DOTNET_INSTALL_DIR=$directory" | Out-File -LiteralPath $env:GITHUB_ENV -Encoding utf8 -Append
"DOTNET_ROOT=$directory" | Out-File -LiteralPath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Set up .NET SDK
uses: https://github.com/actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1
with:
dotnet-version: '10.0.x'
- name: Prepare pinned packaging tools
shell: pwsh
run: ./tool/gitea/prepare-package-tools.ps1