Skip to content

Commit 141eae3

Browse files
committed
separate Windows build jobs to use native ARM64 runners and simplify build logic
1 parent d878d47 commit 141eae3

1 file changed

Lines changed: 39 additions & 16 deletions

File tree

.github/workflows/build.yml

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@ on:
66
workflow_dispatch:
77

88
jobs:
9-
build-windows:
10-
name: Build Windows ${{ matrix.arch }}
9+
build-windows-x64:
10+
name: Build Windows x64
1111
runs-on: windows-latest
12-
strategy:
13-
matrix:
14-
arch: [x64, arm64]
1512

1613
steps:
1714
- uses: actions/checkout@v4
@@ -23,30 +20,56 @@ jobs:
2320
cache: true
2421

2522
- name: Install dependencies
23+
shell: pwsh
2624
run: flutter pub get
2725

2826
- name: Build Windows
29-
run: |
30-
if ("${{ matrix.arch }}" -eq "arm64") {
31-
flutter build windows --target-platform windows-arm64
32-
} else {
33-
flutter build windows
34-
}
27+
run: flutter build windows --release
3528

3629
- name: Package Windows Artifact
3730
shell: pwsh
3831
run: |
3932
$version = (Get-Content pubspec.yaml | Select-String "version: " | ForEach-Object { $_.ToString().Split(": ")[1].Trim() })
4033
$folder = "build/windows/x64/runner/Release"
41-
if ("${{ matrix.arch }}" -eq "arm64") {
42-
$folder = "build/windows/arm64/runner/Release"
43-
}
44-
Compress-Archive -Path "$folder/*" -DestinationPath "belegium_${version}_windows_${{ matrix.arch }}.zip"
34+
Compress-Archive -Path "$folder/*" -DestinationPath "belegium_${version}_windows_x64.zip"
35+
36+
- name: Upload Artifact
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: windows-x64-build
40+
path: "*.zip"
41+
42+
build-windows-arm64:
43+
name: Build Windows ARM64
44+
runs-on: windows-11-arm # Uses native ARM runner for public repos
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- name: Setup Flutter
50+
uses: subosito/flutter-action@v2
51+
with:
52+
channel: 'stable'
53+
cache: true
54+
55+
- name: Install dependencies
56+
shell: pwsh
57+
run: flutter pub get
58+
59+
- name: Build Windows
60+
run: flutter build windows --release
61+
62+
- name: Package Windows Artifact
63+
shell: pwsh
64+
run: |
65+
$version = (Get-Content pubspec.yaml | Select-String "version: " | ForEach-Object { $_.ToString().Split(": ")[1].Trim() })
66+
$folder = "build/windows/arm64/runner/Release"
67+
Compress-Archive -Path "$folder/*" -DestinationPath "belegium_${version}_windows_arm64.zip"
4568
4669
- name: Upload Artifact
4770
uses: actions/upload-artifact@v4
4871
with:
49-
name: windows-${{ matrix.arch }}-build
72+
name: windows-arm64-build
5073
path: "*.zip"
5174

5275
build-macos:

0 commit comments

Comments
 (0)