-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (54 loc) · 2.08 KB
/
android.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
name: Build for Android
on:
push:
jobs:
build:
name: Build APK
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: '12.x'
- name: Install flutter
uses: subosito/flutter-action@v1
- name: Install app dependencies (flutter pub get)
run: flutter pub get
# - name: Run tests
# run: flutter test
- name: Extract app variables to workflow env
run: |
sudo wget -q "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64" -O "/usr/bin/yq"
sudo chmod +x /usr/bin/yq
echo "TAG_NAME=$(yq eval .version pubspec.yaml | cut -d+ -f1)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "COMMIT_MESSAGE=$(git log -n 1 --oneline | cut -d' ' -f2- -)" >> $GITHUB_ENV
echo "CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
- name: Set up signing config
run: |
echo "${{ secrets.SIGNING_KEYSTORE_CONTENT }}" | base64 -d - > android/key.keystore
echo "${{ secrets.SIGNING_PROPERTIES_CONTENT }}" > android/key.properties
- name: Build signed APK
run: flutter build apk --release
- name: Show APK hashes
run: find build/app/outputs -type f -name "*.apk" | xargs -L1 sha256sum
- name: Upload release
uses: softprops/action-gh-release@v1
with:
files: |
build/app/outputs/flutter-apk/*-release.apk
tag_name: v${{ env.TAG_NAME }}
name: ${{ env.COMMIT_MESSAGE }}
body: ${{ env.COMMIT_MESSAGE }}
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ env.CURRENT_BRANCH == 'main' }}
- name: Delete older releases
uses: dev-drprasad/[email protected]
with:
keep_latest: 1
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}