-
Notifications
You must be signed in to change notification settings - Fork 23
81 lines (66 loc) · 2.64 KB
/
deploy_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
70
71
72
73
74
75
76
77
78
79
80
81
name: Deploy Android (Google Play Store)
on:
# Only trigger, when the "build" workflow succeeded (only works in the Master Branch)
workflow_run:
workflows: ["Build & Test"]
types:
- completed
# Only trigger, when pushing into the `main` branch
push:
branches: [main]
# DELETE THIS
pull_request:
branches: [ "main" ]
permissions:
contents: write
jobs:
build-and-deploy_android:
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v3
# Needed to base64 decode the upload keystore
- name: ⚙️ Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: "12.x"
cache: 'gradle'
id: java
# Needed to run Flutter-based commands
- name: 🐦 Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.13.5"
channel: "stable"
- name: 📚 Install dependencies
run: flutter pub get
- name: 🔒 Retrieve base64 keystore and decode it to a file
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_FILE_BASE64 }}
run: echo $KEYSTORE_BASE64 | base64 --decode > "${{ github.workspace }}/decoded_android-keystore.jks"
# Creates keystore file.
# Needs to be the same as the one defined in `android/app/build.gradle`
- name: 📝🔐 Create key.properties file
env:
KEYSTORE_PROPERTIES_PATH: ${{ github.workspace }}/android/key.properties
run: |
touch $KEYSTORE_PROPERTIES_PATH
echo 'storeFile=${{ github.workspace }}/decoded_android-keystore.jks' > $KEYSTORE_PROPERTIES_PATH
echo 'keyAlias=${{ secrets.KEYSTORE_KEY_ALIAS }}' >> $KEYSTORE_PROPERTIES_PATH
echo 'storePassword=${{ secrets.KEYSTORE_PASSWORD }}' >> $KEYSTORE_PROPERTIES_PATH
echo 'keyPassword=${{ secrets.KEYSTORE_KEY_PASSWORD }}' >> $KEYSTORE_PROPERTIES_PATH
- name: 📦 Create Android appbundle release
run: |
flutter build appbundle \
--obfuscate \
--split-debug-info=${{ github.workspace }}/debug_info
- name: 🚀 Upload Android Release to Play Store
uses: r0adkll/[email protected]
with:
# MUST match the package name defined in `android/app/build.gradle`
packageName: com.dwyl.app
# Can be 'alpha'/'beta'/'internal'/'production'
track: production
releaseFiles: ${{ github.workspace }}/build/app/outputs/bundle/release/app-release.aab
serviceAccountJsonPlainText: "${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_KEY_JSON }}"