-
Notifications
You must be signed in to change notification settings - Fork 166
66 lines (62 loc) · 3.07 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
name: Android Ci Release
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- ".github/**"
- "!.github/workflows/**"
- ".idea/"
- "doc/*"
- "*.md"
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 Beta Channel & Canary 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:
GROUP_ID: ${{ secrets.CANARY_GROUP_ID }}
CHANNEL_ID: ${{ secrets.CHANNEL_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"; } > ${{ github.workspace }}/git_log
ESCAPED="$(cat ${{ github.workspace }}/git_log | gawk '{gsub(/[_*[\]()~`>#+=\|{}.!-]/,"\\\\\\\\&")}1' | sed -e 's|"|\\"|g' -e '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%22${ESCAPED}%22%7D%5D" -F canary="@${CANARY}"
# curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_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%22${ESCAPED}%22%7D%5D" -F canary="@${CANARY}"