-
Notifications
You must be signed in to change notification settings - Fork 4
82 lines (70 loc) · 2.7 KB
/
ci.yaml
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
name: CI
on:
push:
branches: [ master ]
pull_request:
jobs:
# Check which files / paths have changed. We use this to inform whether we should run
# later jobs. Even though there is only a single job for now (build_android) we only
# want to run it if the app itself has changed, not the app data (since we don't
# bundle that in to the app anymore).
changes:
outputs:
android: ${{ steps.filter.outputs.android }}
data: ${{ steps.filter.outputs.data }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: '.github/filters.yml'
- name: Print changes
run: printf "Android files changed $ANDROID\Data files changed $DATA\n"
env:
ANDROID: ${{ steps.filter.outputs.android }}
DATA: ${{ steps.filter.outputs.data }}
build_android:
needs: [changes]
if: needs.changes.outputs.android == 'true' || needs.changes.outputs.data == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: echo "${{ secrets.UPLOAD_KEYSTORE }}" | base64 -d > android/upload_keystore.jks
- run: echo "${{ secrets.KEY_PROPERTIES }}" | base64 -d > android/key.properties
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- uses: subosito/flutter-action@v1
with:
flutter-version: '3.24.4'
channel: stable
# Initial build and test.
- run: flutter pub get
# Run tests.
- run: flutter test
# Build apk. This will be signed.
- run: flutter build apk
if: needs.changes.outputs.android == 'true' && github.event_name == 'push'
# Publish apk to Github Packages
- uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0
if: needs.changes.outputs.android == 'true' && github.event_name == 'push'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: "Latest apk build"
files: build/app/outputs/flutter-apk/app-release.apk
# Build appbundle. This will be signed.
- run: flutter build appbundle
if: needs.changes.outputs.android == 'true' && github.event_name == 'push'
# Publish appbundle to the store.
- name: Publish Android build to internal track
uses: r0adkll/[email protected]
if: needs.changes.outputs.android == 'true' && github.event_name == 'push'
with:
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }}
packageName: com.banool.auslan_dictionary
releaseFile: build/app/outputs/bundle/release/app-release.aab
track: internal