-
Notifications
You must be signed in to change notification settings - Fork 5
61 lines (50 loc) · 1.84 KB
/
build.yml
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
name: Flutter Build and Upload
on:
push:
paths-ignore:
- '**.md'
env:
FLUTTER_VERSION: 3.19.5
jobs:
build:
name: Build and Upload Android Binary
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '${{ env.FLUTTER_VERSION }}'
- name: Install Dependencies
run: flutter pub get
- name: Generate Code
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Build Android Binary
run: flutter build apk
- name: Sign APK
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#android
run: |
python3 -c 'import os, base64; open("output.jks", "wb").write(base64.b64decode(os.environ.get("SIGNING_KEY_BASE64")))'
"$ANDROID_HOME/build-tools/34.0.0/apksigner" sign --ks output.jks -v --v2-signing-enabled true --ks-key-alias "$SIGNING_KEY_ALIAS" --ks-pass "pass:$KEY_STORE_PASSWORD" "$APK_PATH"
env:
SIGNING_KEY_BASE64: ${{ secrets.SIGNING_KEY }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
APK_PATH: build/app/outputs/flutter-apk/app-release.apk
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: android-app
path: build/app/outputs/flutter-apk/app-release.apk
release:
if: startsWith(github.ref, 'refs/tags/24')
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: "build/app/outputs/flutter-apk/app-release.apk"
prerelease: ${{ contains(github.ref, 'dev') }}