-
Notifications
You must be signed in to change notification settings - Fork 78
98 lines (83 loc) · 2.85 KB
/
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
name: CI
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: adopt-hotspot
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Build release APK
run: ./gradlew assembleRelease
- name: Build release AAB
run: ./gradlew bundleRelease
- uses: actions/upload-artifact@v4
with:
name: unsigned-app.apk
path: app/build/outputs/apk/release/app-release-unsigned.apk
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: unsigned-app.aab
path: app/build/outputs/bundle/release/app-release.aab
if-no-files-found: error
deploy:
name: Deploy to GitHub Releases
needs: build
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Get the APK
uses: actions/download-artifact@v4
with:
name: unsigned-app.apk
path: .
- name: Get the AAB
uses: actions/download-artifact@v4
with:
name: unsigned-app.aab
path: .
- name: Detect latest build tool version
shell: bash
run: |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
echo Latest build tool version is: $BUILD_TOOL_VERSION
- name: Sign the APK & AAB
uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: .
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyStorePassword: ${{ secrets.SIGNING_KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
- name: List release files
run: ls -l
- name: Rename release files
run: |
mv ./app-release-unsigned-signed.apk ./httptoolkit.apk
mv ./app-release.aab ./httptoolkit.aab
- name: Publish the APK & AAB to GitHub Releases
uses: svenstaro/upload-release-action@v2
with:
prerelease: true
file: ./httptoolkit{.apk,.aab}
file_glob: true
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish the AAB to Google Play
uses: r0adkll/[email protected]
with:
serviceAccountJsonPlainText: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}
packageName: tech.httptoolkit.android.v1
releaseFiles: ./httptoolkit.aab
track: production