-
Notifications
You must be signed in to change notification settings - Fork 2
115 lines (100 loc) · 4.96 KB
/
Copy pathrelease-mobile-client.yml
File metadata and controls
115 lines (100 loc) · 4.96 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
name: Mobile Client Release (APKs)
permissions:
contents: write
on:
release:
types: [published]
jobs:
init:
if: startsWith(github.ref_name, 'client-mobile')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Parse client version
working-directory: ErmisClient/Mobile/ermis_client
id: version
run: |
SEM_VER=$(echo "${GITHUB_REF_NAME#client-mobile-v}")
BUILD_NUMBER=$(cat pubspec.yaml | grep "version: " | cut -d+ -f2)
VERSION="${SEM_VER}+$((BUILD_NUMBER + 1))"
echo "client_version=$VERSION" >> $GITHUB_OUTPUT
- name: Update client version in pubspec.yaml
working-directory: ErmisClient/Mobile/ermis_client
run: |
sed -i "0,/version: .*/s//version: ${{ steps.version.outputs.client_version }}/" pubspec.yaml
- name: Commit and push updated pubspec.yaml
working-directory: ErmisClient/Mobile/ermis_client
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git remote set-url origin https://github.com/Koukobin/Ermis.git
git add pubspec.yaml
git commit -m "chore: update client version in pubspec.yaml to ${{ steps.version.outputs.client_version }}"
git push origin HEAD:master
release:
if: success() && startsWith(github.ref_name, 'client-mobile')
needs: [init]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Android SDK at /opt/android-sdk
run: |
sudo mkdir -p /opt/android-sdk/cmdline-tools
sudo chown -R $USER /opt/android-sdk
# Download cmdline-tools
wget -q https://dl.google.com/android/repository/commandlinetools-linux-14742923_latest.zip -O /tmp/cmdline-tools.zip
unzip -q /tmp/cmdline-tools.zip -d /opt/android-sdk/cmdline-tools
mv /opt/android-sdk/cmdline-tools/cmdline-tools /opt/android-sdk/cmdline-tools/latest
# Install SDK, build tools, and NDK
yes | /opt/android-sdk/cmdline-tools/latest/bin/sdkmanager \
"platforms;android-34" \
"build-tools;34.0.0" \
"ndk;27.0.12077973"
echo "ANDROID_SDK_ROOT=/opt/android-sdk" >> $GITHUB_ENV
echo "ANDROID_HOME=/opt/android-sdk" >> $GITHUB_ENV
echo "/opt/android-sdk/cmdline-tools/latest/bin" >> $GITHUB_PATH
echo "/opt/android-sdk/platform-tools" >> $GITHUB_PATH
- name: Set up Flutter
uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2
with:
flutter-version: '3.41.1'
- name: Decode Keystore
working-directory: ErmisClient/Mobile/ermis_client
run: |
touch android/app/my-release-key.keystore
echo "$RELEASE_STORE_FILE_ENCODED" | base64 --decode > android/app/my-release-key.keystore
env:
RELEASE_STORE_FILE_ENCODED: ${{ secrets.RELEASE_STORE_FILE_ENCODED }}
- name: Build
working-directory: ErmisClient/Mobile/ermis_client
run: |
chmod +x build.sh
./build.sh
# Build fat APK
flutter build apk --release
mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/app-fat-release.apk
# Build ABI-specific APKs
flutter build apk --release --split-per-abi
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk build/app/outputs/app-split-arm64-release.apk
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk build/app/outputs/app-split-arm32-release.apk
mv build/app/outputs/flutter-apk/app-x86_64-release.apk build/app/outputs/app-split-x64-release.apk
# Build app bundle
flutter build aab --release
mv build/app/outputs/bundle/release/app-release.aab build/app/outputs/app-release.aab
env:
RELEASE_STORE_FILE: my-release-key.keystore
RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
RELEASE_STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }}
PUB_CACHE: /home/runner/work/Ermis/Ermis/ErmisClient/Mobile/ermis_client/.pub-cache # Required to match F-Droid pub cache path
- name: Upload APKs to Release
uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1
with:
files: |
ErmisClient/Mobile/ermis_client/build/app/outputs/app-fat-release.apk
ErmisClient/Mobile/ermis_client/build/app/outputs/app-split-arm64-release.apk
ErmisClient/Mobile/ermis_client/build/app/outputs/app-split-arm32-release.apk
ErmisClient/Mobile/ermis_client/build/app/outputs/app-split-x64-release.apk
ErmisClient/Mobile/ermis_client/build/app/outputs/app-release.aab