-
Notifications
You must be signed in to change notification settings - Fork 166
63 lines (59 loc) · 2.72 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
name: Android Ci Release
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
paths-ignore:
- "README.md"
- "README_en-US.md"
- "doc/*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-java@v3
with:
java-version: "19"
distribution: "temurin"
cache: gradle
- name: Build with Gradle Canary
shell: bash
run: ./gradlew assembleCanary
- name: Sign Canary APK
if: success()
id: sign_canary
uses: r0adkll/[email protected]
with:
releaseDirectory: ./app/build/outputs/apk/canary
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_STORE_PASSWORD }}
- name: Upload Canary APK
if: contains(github.event.head_commit.message, '[upload]') == true
uses: actions/upload-artifact@v3
with:
name: Cemiuiler canary
path: ${{ steps.sign_canary.outputs.signedReleaseFile }}
- name: Post to group
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.ref_type != 'tag' && contains(github.event.head_commit.message, '[skip post]') == false && contains(github.event.head_commit.message, 's#') == false }}
shell: bash
env:
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
GROUP_ID: ${{ secrets.CANARY_GROUP_ID }}
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
CANARY: ${{ steps.sign_canary.outputs.signedReleaseFile }}
run: |
mkdir -p ${{ github.workspace }}/git_clone
git clone ${{ github.event.repository.url }} ${{ github.workspace }}/git_clone -b ${{ github.ref_name }}
cd ${{ github.workspace }}/git_clone
{ echo -e '"Github CI\n'; git log ${{ github.event.before }}..${{ github.event.after }} --pretty=format:"%h %s"; echo -n '"'; } > ${{ github.workspace }}/git_log
ESCAPED="$(cat ${{ github.workspace }}/git_log | gawk '{gsub(/[_*[\]()~`>#+=\|{}.!-]/,"\\\\\\\\&")}1' | sed 's|^[0-9a-z]\+|\_\_&\_\_|' | hexdump -v -e '/1 "%02X"' | sed 's/\(..\)/%\1/g')"
cd ${{ github.workspace }}
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${GROUP_ID}&message_thread_id=${MESSAGE_THREAD_ID}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fcanary%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22%3A${ESCAPED}%7D%5D" -F canary="@${CANARY}"