forked from LibChecker/LibChecker
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (128 loc) · 5 KB
/
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
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
name: Android CI
on:
push:
branches:
- master
paths-ignore:
- '.idea/**'
- '.gitattributes'
- '.github/**.json'
- '.gitignore'
- '.gitmodules'
- '**.md'
- 'LICENSE'
- 'NOTICE'
pull_request:
paths-ignore:
- '.idea/**'
- '.gitattributes'
- '.github/**.json'
- '.gitignore'
- '.gitmodules'
- '**.md'
- 'LICENSE'
- 'NOTICE'
jobs:
check:
name: Check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Check style
uses: gradle/gradle-build-action@v2
with:
arguments: lintKotlin
build:
name: Build
runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.head_commit.message, '[skip ci]') }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Retrieve version
run: |
echo VERSION=$(echo ${{ github.event.head_commit.id }} | head -c 10) >> $GITHUB_ENV
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: -PappVerName=${{ env.VERSION }} assembleRelease
- name: Sign Android release
if: success() && github.event_name != 'pull_request' && github.repository == 'zhaobozhen/LibChecker'
id: sign
uses: r0adkll/sign-android-release@v1.0.4
env:
BUILD_TOOLS_VERSION: "32.0.0"
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Upload built apk
if: success() && github.event_name != 'pull_request' && github.repository == 'zhaobozhen/LibChecker'
uses: actions/upload-artifact@v3
with:
name: snapshot
path: ${{ steps.sign.outputs.signedReleaseFile }}
- name: Upload mappings
if: success() && github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v3
with:
name: mappings
path: "app/build/outputs/mapping/release"
- name: Get apk info
if: success() && github.event_name != 'pull_request' && github.repository == 'zhaobozhen/LibChecker'
id: apk-info
uses: hkusu/apk-info-action@v1
with:
apk-path: ${{ steps.sign.outputs.signedReleaseFile }}
- name: Upload mappings with App Center CLI
if: success() && github.event_name != 'pull_request' && github.repository == 'zhaobozhen/LibChecker'
uses: avocaddo/AppCenter-Github-Action@v1.0.2
with:
command: appcenter crashes upload-mappings --mapping app/build/outputs/mapping/release/mapping.txt --version-name ${{ steps.apk-info.outputs.version-name }} --version-code ${{ steps.apk-info.outputs.version-code }} --app zhaobozhen2025-gmail.com/LibChecker
token: ${{secrets.APP_CENTER_TOKEN}}
- name: Send commit to telegram
if: success() && github.repository == 'zhaobozhen/LibChecker' && github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
env:
CHANNEL_ID: ${{ secrets.TELEGRAM_TO }}
BOT_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
FILE: ${{ github.workspace }}/${{ steps.sign.outputs.signedReleaseFile }}
COMMIT_MESSAGE: |+
New push to github\!
```
${{ github.event.head_commit.message }}
```by `${{ github.event.head_commit.author.name }}`
See commit detail [here](${{ github.event.head_commit.url }})
Snapshot apk is attached
run: |
ESCAPED=`python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE"])))'`
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://release%22,%22parse_mode%22:%22MarkdownV2%22,%22caption%22:${ESCAPED}%7D%5D" -F release="@$FILE"
skipped:
runs-on: ubuntu-latest
if: ${{ startsWith(github.event.head_commit.message, '[skip ci]') }}
steps:
- uses: actions/checkout@v3
- name: Send commit to telegram
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |+
New push to github!
*${{ github.event.head_commit.message }}* by ${{ github.event.head_commit.author.name }}
See commit detail [here](${{ github.event.head_commit.url }})
This push skipped building