-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (112 loc) · 4.38 KB
/
release.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
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
133
134
135
136
name: Flutter Build and Release
on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for this release (e.g., v1.0.0)'
required: true
default: '1.0.0'
release_note:
description: 'Release notes for this version'
required: true
default: 'Initial release'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.0' # Specify your Flutter version
- name: Install dependencies
run: flutter pub get
- name: Run tests
run: flutter test
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu' # Use Zulu OpenJDK
java-version: '17' # Java 11 is required for signing
- name: Build for APK ABIs
run: flutter build apk --split-per-abi --build-name=${{github.event.inputs.tag_name}}
- name: Build for APK
run: flutter build apk --release --build-name=${{github.event.inputs.tag_name}}
- name: Build App Bundle
run: flutter build appbundle --release --build-name=${{github.event.inputs.tag_name}}
# - name: Setup Android SDK
# uses: android-actions/setup-android@v3
# - name: Sign APK
# run: |
# echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 -d > keystore.jks
# echo "${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" > keystore_password.txt
# echo "${{ secrets.ANDROID_KEY_ALIAS }}" > key_alias.txt
# echo "${{ secrets.ANDROID_KEY_PASSWORD }}" > key_password.txt
# LATEST_BUILD_TOOLS=$(ls $ANDROID_HOME/build-tools | sort -V | tail -n 1)
# ZIPALIGN="$ANDROID_HOME/build-tools/$LATEST_BUILD_TOOLS/zipalign"
# for apk in build/app/outputs/flutter-apk/*-release.apk; do
# [ -f "$apk" ] || continue
# filename=$(basename "$apk")
# signed_name="${filename%.*}-signed.apk"
# jarsigner -verbose \
# -keystore keystore.jks \
# -storepass $(cat keystore_password.txt) \
# -keypass $(cat key_password.txt) \
# "$apk" \
# $(cat key_alias.txt)
# $ZIPALIGN -v 4 \
# "$apk" \
# "build/app/outputs/flutter-apk/$signed_name"
# done
# - name: Sign App Bundle
# run: |
# # We can reuse the keystore and password files from APK signing
# jarsigner -verbose \
# -keystore keystore.jks \
# -storepass $(cat keystore_password.txt) \
# -keypass $(cat key_password.txt) \
# build/app/outputs/bundle/release/app-release.aab \
# $(cat key_alias.txt)
# # Create a directory for the signed bundle
# mkdir -p build/app/outputs/bundle/release/signed
# # Move the signed bundle
# mv build/app/outputs/bundle/release/app-release.aab \
# build/app/outputs/bundle/release/signed/app-release-signed.aab
- name: Upload Signed APK as artifact
uses: actions/upload-artifact@v4
with:
name: signed-apk
path: build/app/outputs/flutter-apk/*-release.apk
- name: Upload App Bundle as artifact
uses: actions/upload-artifact@v4
with:
name: app-release.aab
path: build/app/outputs/bundle/release/signed/app-release.aab
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Signed APK artifact
uses: actions/download-artifact@v4
with:
name: signed-apk
path: build/apk
- name: Download App Bundle artifact
uses: actions/download-artifact@v4
with:
name: app-release.aab
path: build/aab
- name: Release Signed APKs
uses: softprops/action-gh-release@v2
with:
body: |
## Release Notes
${{ github.event.inputs.release_note }}
files: |
build/apk/*-release.apk
build/aab/app-release.aab
tag_name: ${{ github.event.inputs.tag_name }} # Use the dynamic tag_name input
name: Release ${{ github.event.inputs.tag_name }} # Use the dynamic tag_name input