-
Notifications
You must be signed in to change notification settings - Fork 3
159 lines (141 loc) · 6.15 KB
/
android-ci.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
name: Android CI
on:
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]
workflow_dispatch:
inputs:
releaseBody:
description: 'Release description'
required: true
default: 'Description release'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
cache-overwrite-existing: true
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
- name: create google-services.json
run: |
echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > app/google-services.json
- name: build
env:
RELEASE: 1.${{ github.run_number }}.${{ steps.slug.outputs.sha8 }}
run: |
chmod +x gradlew
./gradlew assembleRelease bundlePlaystoreRelease --stacktrace
- uses: r0adkll/sign-android-release@v1
name: Sign app APK
id: sign_apk
with:
releaseDirectory: app/build/outputs/apk/nostore/release
signingKeyBase64: ${{ secrets.KEYSTORE }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_PASS }}
keyPassword: ${{ secrets.KEY_PASS }}
env:
BUILD_TOOLS_VERSION: "30.0.3"
- uses: r0adkll/sign-android-release@v1
name: Sign app APK
id: sign_playstore_apk
with:
releaseDirectory: app/build/outputs/apk/playstore/release
signingKeyBase64: ${{ secrets.KEYSTORE }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_PASS }}
keyPassword: ${{ secrets.KEY_PASS }}
env:
BUILD_TOOLS_VERSION: "30.0.3"
- uses: r0adkll/sign-android-release@v1
name: Sign app Bundle
id: sign_aab
with:
releaseDirectory: app/build/outputs/bundle/playstoreRelease
signingKeyBase64: ${{ secrets.KEYSTORE_UPLOAD }}
alias: ${{ secrets.ALIAS_UPLOAD }}
keyStorePassword: ${{ secrets.KEY_PASS }}
keyPassword: ${{ secrets.KEY_PASS }}
env:
BUILD_TOOLS_VERSION: "30.0.3"
- name: copy release file
run: |
cp ${{steps.sign_apk.outputs.signedReleaseFile}} navi-to-tesla_nostore.1.${{ github.run_number }}.apk
cp ${{steps.sign_playstore_apk.outputs.signedReleaseFile}} navi-to-tesla_playstore.1.${{ github.run_number }}.apk
cp ${{steps.sign_aab.outputs.signedReleaseFile}} navi-to-tesla.1.${{ github.run_number }}.aab
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 1.${{ github.run_number }}.${{ steps.slug.outputs.sha8 }}
release_name: Release 1.${{ github.run_number }}.${{ steps.slug.outputs.sha8 }}
body: ${{ github.event.inputs.releaseBody }}
draft: false
prerelease: true
- name: Upload Release Asset
id: upload-release-asset-apk
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: navi-to-tesla_nostore.1.${{ github.run_number }}.apk
asset_name: navi-to-tesla_nostore.1.${{ github.run_number }}.apk
asset_content_type: application/vnd.android.package-archive
- uses: actions/upload-artifact@v2
with:
name: Signed app apk
path: navi-to-tesla_nostore.1.${{ github.run_number }}.apk
- name: Upload Release Asset
id: upload-release-asset-apk-playstore
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: navi-to-tesla_playstore.1.${{ github.run_number }}.apk
asset_name: navi-to-tesla_playstore.1.${{ github.run_number }}.apk
asset_content_type: application/vnd.android.package-archive
- uses: actions/upload-artifact@v2
with:
name: Signed app apk
path: navi-to-tesla_playstore.1.${{ github.run_number }}.apk
- name: Upload Release Asset
id: upload-release-asset-aab
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: navi-to-tesla.1.${{ github.run_number }}.aab
asset_name: navi-to-tesla.1.${{ github.run_number }}.aab
asset_content_type: application/vnd.android.package-archive
# Example use of `signedReleaseFile` output -- not needed
- uses: actions/upload-artifact@v2
with:
name: Signed app bundle
path: navi-to-tesla.1.${{ github.run_number }}.aab
- name: Upload to Google play
id: upload-release-to-play
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.PLAY_SERVICE_JSON }}
packageName: me.zipi.navitotesla
releaseFiles: ${{steps.sign_aab.outputs.signedReleaseFile}}
releaseName: 1.${{ github.run_number }}.${{ steps.slug.outputs.sha8 }}
track: internal
status: completed
mappingFile: app/build/outputs/mapping/playstoreRelease/mapping.txt