-
Notifications
You must be signed in to change notification settings - Fork 8
194 lines (156 loc) · 5.66 KB
/
deployment.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Create Release
on:
push:
tags:
- '*'
jobs:
lint_verify:
name: Lint and verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/[email protected]
- name: Build Project with Gradle
uses: gradle/gradle-build-action@v2
- name: Lint
run: ./gradlew ktlintCheck
- name: Tests
run: ./gradlew :shared:testReleaseUnitTest
android_release:
name: Build and release android app
runs-on: ubuntu-latest
needs: lint_verify
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Build Project with Gradle
uses: gradle/gradle-build-action@v2
- name: Build Release AAB
id: build_release
run: ./gradlew androidApp:bundleRelease
- name: Sign AAB
id: sign_aab
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: androidApp/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Create release apk path
run: mkdir --parents androidApp/build/outputs/apks/release
- name: Build Release APK
id: build_release_apk
run: |
./gradlew androidApp:assembleRelease
## move to apks/release
mv androidApp/build/outputs/apk/release/*.apk androidApp/build/outputs/apks/release
- name: Build Foss APK
id: build_release_apk_foss
run: |
sh strip_google_services.sh
./gradlew androidApp:assembleRelease
## set appropriate nam, i.e. play-deals-*-release-unsigned.apk -> play-deals-*-release-foss-unsigned.apk
TMP_APK=$(ls androidApp/build/outputs/apk/release/*.apk)
FOSS_APK="${TMP_APK/-release-unsigned/"-release-foss-unsigned"}"
mv $TMP_APK $FOSS_APK
## move to apks/release
mv androidApp/build/outputs/apk/release/*.apk androidApp/build/outputs/apks/release
- name: Upload to google play console
uses: r0adkll/upload-google-play@v1
id: upload_to_play_console
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: me.sujanpoudel.playdeals
releaseFiles: ${{ steps.sign_aab.outputs.signedReleaseFile}}
inAppUpdatePriority: 5
whatsNewDirectory: CHANGELOG/android-whats-new
releaseName: ${{ github.ref_name }}
status: draft
- name: Sign APKs
id: sign_apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: androidApp/build/outputs/apks/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Collect Artifacts
id: collect_artifacts
run: |
ARTIFACTS=androidApp/build/outputs/artifacts
mkdir $ARTIFACTS
TMP_APK=$(ls androidApp/build/outputs/apks/release/*-release-unsigned-signed.apk)
RELEASE_APK="${TMP_APK/-release-unsigned-signed/""}"
mv $TMP_APK $RELEASE_APK
mv $RELEASE_APK $ARTIFACTS
TMP_APK=$(ls androidApp/build/outputs/apks/release/*-release-foss-unsigned-signed.apk)
RELEASE_APK="${TMP_APK/-release-foss-unsigned-signed/"-foss"}"
mv $TMP_APK $RELEASE_APK
mv $RELEASE_APK $ARTIFACTS
TMP_BUNDLE=$(ls androidApp/build/outputs/bundle/release/*.aab)
RELEASE_BUNDLE="${TMP_BUNDLE/-release/""}"
mv $TMP_BUNDLE $RELEASE_BUNDLE
mv $RELEASE_BUNDLE $ARTIFACTS
echo "artifacts=$ARTIFACTS" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
with:
name: android-bundles
path: ${{ steps.collect_artifacts.outputs.artifacts }}
desktop_release:
name: Build desktop apps
strategy:
matrix:
os: [ 'ubuntu-latest', 'windows-latest','macos-latest' ]
needs: lint_verify
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Build Project with Gradle
uses: gradle/gradle-build-action@v2
- name: Bundle Package
id: bundle_package
run: |
./gradlew packageDistributionForCurrentOS
echo "package=$(ls desktopApp/build/compose/binaries/main*/*/deals-*-*.*)" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}_bundle
path: ${{ steps.bundle_package.outputs.package }}
github_release:
needs: [ android_release,desktop_release ]
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: downloaded
- name: Collect artifacts
run: |
mkdir artifacts
mv downloaded/**/*.* artifacts/
- uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG/CHANGELOG.md
files: artifacts/*