-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (111 loc) · 4.09 KB
/
Copy pathbuild-multi-platform.yml
File metadata and controls
132 lines (111 loc) · 4.09 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
name: Build Multi Platform
on:
workflow_dispatch:
push:
branches: ["master"]
tags: ["v*"]
jobs:
build-desktop:
name: Build ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- name: linux
os: ubuntu-latest
build_command: flutter build linux --release
artifact_path: build/linux/x64/release/bundle
artifact_name: ailurus-linux
- name: windows
os: windows-latest
build_command: flutter build windows --release
artifact_path: build/windows/x64/runner/Release
artifact_name: ailurus-windows
- name: macos
os: macos-latest
build_command: flutter build macos --release
artifact_path: build/macos/Build/Products/Release
artifact_name: ailurus-macos
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev
- name: Enable desktop targets
run: |
flutter config --enable-linux-desktop
flutter config --enable-windows-desktop
flutter config --enable-macos-desktop
- name: Get dependencies
run: flutter pub get
- name: Build desktop app
run: ${{ matrix.platform.build_command }}
- name: Upload desktop artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.artifact_name }}
path: ${{ matrix.platform.artifact_path }}
if-no-files-found: error
build-android-release:
name: Build signed android apk
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
environment: release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Get dependencies
run: flutter pub get
- name: Restore Android keystore
run: |
echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > android/release-keystore.jks
- name: Create key.properties
run: |
cat > android/key.properties <<EOF
storePassword=${{ secrets.ANDROID_STORE_PASSWORD }}
keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}
keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}
storeFile=release-keystore.jks
EOF
- name: Build signed Android APK
run: flutter build apk --release
- name: Verify APK signature
run: |
BUILD_TOOLS_VERSION=$(ls "$ANDROID_HOME/build-tools" | sort -V | tail -n 1)
"$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION/apksigner" verify --print-certs build/app/outputs/flutter-apk/app-release.apk
- name: Generate checksums
run: |
sha256sum build/app/outputs/flutter-apk/app-release.apk > build/app/outputs/flutter-apk/app-release.apk.sha256
- name: Export signing certificate details
run: |
BUILD_TOOLS_VERSION=$(ls "$ANDROID_HOME/build-tools" | sort -V | tail -n 1)
"$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION/apksigner" verify --print-certs build/app/outputs/flutter-apk/app-release.apk \
> build/app/outputs/flutter-apk/app-release.cert.txt
- name: Upload Android artifact
uses: actions/upload-artifact@v4
with:
name: ailurus-android-signed
path: |
build/app/outputs/flutter-apk/app-release.apk
build/app/outputs/flutter-apk/app-release.apk.sha256
build/app/outputs/flutter-apk/app-release.cert.txt
if-no-files-found: error