forked from jonjomckay/fritter
-
Notifications
You must be signed in to change notification settings - Fork 18
112 lines (98 loc) · 4.84 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
name: release
on:
workflow_dispatch:
push:
tags:
- '*'
jobs:
create_release:
runs-on: ubuntu-latest
steps:
- name: Clone the repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install and set up Java
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '14.x'
- name: Install and set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.16.9'
channel: 'stable'
- name: Set up signing key
run: echo $SIGNING_KEY | base64 -d > android/app/key.jks
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
- name: Set env
if: github.event_name == 'push'
run: |
APP_VERSION=$(echo ${{github.ref_name}} | sed 's/v//g')
echo "APPLICATION_VERSION=$APP_VERSION" >> $GITHUB_ENV
APP_BUILD_BASE=300000000
COMMIT_NUMBER=$(git rev-list HEAD --count)
APP_BUILD_NUMBER=$((COMMIT_NUMBER*10+APP_BUILD_BASE))
echo "APPLICATION_BUILD_NUMBER=$APP_BUILD_NUMBER" >> $GITHUB_ENV
- name: Build APKs
run: |
flutter config --no-analytics
flutter pub get
flutter pub run flutter_oss_licenses:generate.dart
flutter pub run intl_utils:generate
# Create a directory for our release APKs
mkdir -pv build/app/outputs/release
# Build our big boy APK, and move it into the release APKs folder
if [[ ${{github.event_name}} == 'push' ]]; then
flutter build apk --dart-define=app.flavor=github --release --no-tree-shake-icons --build-name=${{env.APPLICATION_VERSION}} --build-number=${{env.APPLICATION_BUILD_NUMBER}}
else
flutter build apk --dart-define=app.flavor=github --release --no-tree-shake-icons
fi
mv build/app/outputs/apk/release/*.apk build/app/outputs/release
# Build our ABI-specific APKs and move them into the release APKs folder
if [[ ${{github.event_name}} == 'push' ]]; then
flutter build apk --dart-define=app.flavor=github --release --no-tree-shake-icons --split-per-abi --target-platform=android-x64,android-arm,android-arm64 --build-name=${{env.APPLICATION_VERSION}} --build-number=${{env.APPLICATION_BUILD_NUMBER}}
else
flutter build apk --dart-define=app.flavor=github --release --no-tree-shake-icons --split-per-abi --target-platform=android-x64,android-arm,android-arm64
fi
mv build/app/outputs/apk/release/*.apk build/app/outputs/release
echo "build-name=${{env.APPLICATION_VERSION}}" > build/app/outputs/release/version.txt
echo "build-number=${{env.APPLICATION_BUILD_NUMBER}}" >> build/app/outputs/release/version.txt
# *** Optional when an alternate F-Droid repository is also used ***
# Build our ABI-specific APKs to copy them remotely to the alternate F-Droid repository.
if [[ -n "$ALT_FDROID_REPO_USER" && -n "$ALT_FDROID_REPO_HOST" && -n "$ALT_FDROID_REPO_FOLDER" ]]; then
if [[ ${{github.event_name}} == 'push' ]]; then
flutter build apk --dart-define=app.flavor=fdroid --release --no-tree-shake-icons --split-per-abi --target-platform=android-x64,android-arm,android-arm64 --build-name=${{env.APPLICATION_VERSION}} --build-number=${{env.APPLICATION_BUILD_NUMBER}}
else
flutter build apk --dart-define=app.flavor=fdroid --release --no-tree-shake-icons --split-per-abi --target-platform=android-x64,android-arm,android-arm64
fi
sshpass -e scp build/app/outputs/apk/release/*.apk $ALT_FDROID_REPO_USER@$ALT_FDROID_REPO_HOST:$ALT_FDROID_REPO_FOLDER
rm build/app/outputs/apk/release/*.apk
fi
env:
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PATH: key.jks
# *** Optional when an alternate F-Droid repository is also used ***
ALT_FDROID_REPO_USER: ${{ secrets.ALT_FDROID_REPO_USER }}
ALT_FDROID_REPO_HOST: ${{ secrets.ALT_FDROID_REPO_HOST }}
ALT_FDROID_REPO_FOLDER: ${{ secrets.ALT_FDROID_REPO_FOLDER }}
SSHPASS: ${{ secrets.ALT_FDROID_REPO_PASSWORD }}
- name: Create release
id: upload-release-assets
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: false
files: |
build/app/outputs/release/*.apk
build/app/outputs/release/*.txt
- name: Publish the release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.upload-release-assets.outputs.id }}