forked from openfoodfacts/smooth-app
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (133 loc) · 5.04 KB
/
android-release-to-org-openfoodfacts-scanner.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Google Play release to org.openfoodfacts.scanner
on:
workflow_call:
inputs:
VERSION_NAME:
required: true
type: string
FLUTTER-CACHE-KEY:
required: true
type: string
VERSION_CODE:
required: true
type: string
# 'PLAY' or
# 'GITHUB' (requires [RELEASE_TAG] for the gh release to push to)
RELEASE_TYPE:
required: true
type: string
# 'apk' or 'appbundle'
BUILD_TYPE:
required: true
type: string
# The name of the entrypoints in packages/smooth_app/lib/entrypoints/android/
# Example for entrypoints/android/main_google_play.dart
# Use <main_google_play> here
FLAVOR:
required: true
type: string
# 'mlkit' or 'zxing'
SCANNER:
required: true
type: string
# 'google_play' or 'uri_store'
APP_REVIEW:
required: true
type: string
TAG_NAME:
required: false
type: string
secrets:
API_JSON_FILE_DECRYPTKEY:
required: true
DECRYPT_GPG_KEYSTORE:
required: true
STORE_JKS_DECRYPTKEY:
required: true
SIGN_STORE_PASSWORD:
required: true
SIGN_KEY_ALIAS:
required: true
SIGN_KEY_PASSWORD:
required: true
env:
JAVA_VERSION: 17
RUBY_VERSION: 3.2.0
jobs:
deploy_android:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- run: echo Release type ${{ inputs.RELEASE_TYPE }} + Build type ${{ inputs.BUILD_TYPE }} + Tag name null if not github release ${{ inputs.TAG_NAME }}
- name: Setup Java JDK
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ env.RUBY_VERSION }}
- name: bundle install
run: bundle install
working-directory: ./packages/smooth_app/android/
- name: Decrypt API JSON file
run: cd ./packages/smooth_app/android/fastlane/envfiles && chmod +x ./decrypt_secrets.sh && ./decrypt_secrets.sh
env:
API_JSON_FILE_DECRYPTKEY: ${{ secrets.API_JSON_FILE_DECRYPTKEY }}
DECRYPT_GPG_KEYSTORE: ${{ secrets.DECRYPT_GPG_KEYSTORE }}
STORE_JKS_DECRYPTKEY: ${{ secrets.STORE_JKS_DECRYPTKEY }}
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
flutter-version: '3.7.0'
cache-key: flutter-3.7.0-${{ hashFiles('**/pubspec.lock') }}
- name: Flutter version
run: flutter --version
- name: Enable correct scanner dependency
run: chmod +x ci/dependencies/scanner/enable_${{ inputs.SCANNER }}_dependency.sh && ci/dependencies/scanner/enable_${{ inputs.SCANNER }}_dependency.sh
- name: Enable correct app review dependency
run: chmod +x ci/dependencies/app_store/enable_${{ inputs.APP_REVIEW }}_dependency.sh && ci/dependencies/app_store/enable_${{ inputs.APP_REVIEW }}_dependency.sh
- name: Get dependencies
run: ci/pub_upgrade.sh
# We are using the android version code here to have the version codes from iOS and android in sync
# in order for Sentry and other tools to work properly
- name: Bump version
uses: maierj/[email protected]
with:
lane: setVersion
subdirectory: ./packages/smooth_app/android/
env:
VERSION_NAME: ${{ inputs.VERSION_NAME }}
VERSION_CODE: ${{ inputs.VERSION_CODE }}
- name: Build app
run: echo $SIGN_STORE_PATH && pwd && cd ./packages/smooth_app/ && pwd && flutter build ${{ inputs.BUILD_TYPE }} --release -t lib/entrypoints/android/${{ inputs.FLAVOR }}.dart
env:
SIGN_STORE_PATH: ./../fastlane/envfiles/keystore.jks
SIGN_STORE_PASSWORD: ${{ secrets.SIGN_STORE_PASSWORD }}
SIGN_KEY_ALIAS: ${{ secrets.SIGN_KEY_ALIAS }}
SIGN_KEY_PASSWORD: ${{ secrets.SIGN_KEY_PASSWORD }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
if: inputs.RELEASE_TYPE == 'GITHUB' && inputs.BUILD_TYPE == 'apk' && inputs.TAG_NAME != ''
continue-on-error: true
with:
file: ./packages/smooth_app/build/app/outputs/flutter-apk/app-release.apk
asset_name: openfoodfacts-${{ inputs.FLAVOR }}-${{ inputs.TAG_NAME }}.apk
tag: ${{ inputs.TAG_NAME }}
overwrite: true
- name: Release AAB
uses: maierj/[email protected]
if: inputs.RELEASE_TYPE == 'PLAY' && inputs.BUILD_TYPE == 'appbundle'
with:
lane: release
subdirectory: ./packages/smooth_app/android/
env:
SIGN_STORE_PATH: ./../fastlane/envfiles/keystore.jks
SIGN_STORE_PASSWORD: ${{ secrets.SIGN_STORE_PASSWORD }}
SIGN_KEY_ALIAS: ${{ secrets.SIGN_KEY_ALIAS }}
SIGN_KEY_PASSWORD: ${{ secrets.SIGN_KEY_PASSWORD }}