-
Notifications
You must be signed in to change notification settings - Fork 87
69 lines (65 loc) · 2.58 KB
/
AndroidCI.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
name: Android CI
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.head_commit.message, '[skip ci]') }}
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Setup JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Retrieve version
run: |
echo VERSION=$(echo ${{ github.event.head_commit.id }} | head -c 10) >> $GITHUB_ENV
- name: Write key
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
run: |
if [ ! -z "${{ secrets.KEY_STORE }}" ]; then
echo releaseStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> gradle.properties
echo releaseKeyAlias='${{ secrets.ALIAS }}' >> gradle.properties
echo releaseKeyPassword='${{ secrets.KEY_PASSWORD }}' >> gradle.properties
echo releaseStoreFile='key.jks' >> gradle.properties
echo ${{ secrets.KEY_STORE }} | base64 --decode > key.jks
fi
- name: Build with Gradle
run: bash ./gradlew -PappVerName=${{ env.VERSION }} assembleRelease
- name: Upload built apk
if: success()
uses: actions/upload-artifact@v2
with:
name: Zhiliao_${{ env.VERSION }}
path: ${{ github.workspace }}/app/build/outputs/apk/release
- 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 }})
Snapshot apk is attached
document: ${{ github.workspace }}/app/build/outputs/apk/release/Zhiliao_${{ env.VERSION }}.apk
skipped:
runs-on: ubuntu-latest
if: ${{ startsWith(github.event.head_commit.message, '[skip ci]') }}
steps:
- uses: actions/checkout@v2
- 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