-
Notifications
You must be signed in to change notification settings - Fork 176
95 lines (84 loc) · 3.38 KB
/
android.yml
File metadata and controls
95 lines (84 loc) · 3.38 KB
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
name: Android CI
on:
push:
branches: [ "master", "feature/*" ]
jobs:
build:
permissions: write-all
runs-on: ubuntu-latest
env:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
if: github.event_name == 'push' && !contains(github.event.head_commit.message, 'Merge')
steps:
- uses: actions/checkout@v6
- name: set up JDK 17
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
cache-dependency-path: |
**/*.gradle*
**/gradle-wrapper.properties
gradle/libs.versions.toml
**/gradle.properties
- name: Write key
if: github.event_name != 'pull_request'
env:
KEY_STORE: ${{ secrets.KEY_STORE }}
run: |
if [ ! -z "$KEY_STORE" ]; then
echo androidStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> gradle.properties
echo androidKeyAlias='${{ secrets.ALIAS }}' >> gradle.properties
echo androidKeyPassword='${{ secrets.KEY_PASSWORD }}' >> gradle.properties
echo androidStoreFile='key.jks' >> gradle.properties
echo "$KEY_STORE" | base64 --decode > key.jks
fi
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build all flavor variants
run: |
./gradlew assembleWhatsappDebug assembleBusinessDebug -Pminify=true
- name: Get short SHA
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
- name: Upload WhatsApp flavor artifacts
uses: actions/upload-artifact@v5
with:
name: whatsapp-debug-app-${{ env.SHORT_SHA }}
path: app/build/outputs/apk/whatsapp/debug/app-whatsapp-debug.apk
- name: Upload Business flavor artifacts
uses: actions/upload-artifact@v5
with:
name: business-debug-app-${{ env.SHORT_SHA }}
path: app/build/outputs/apk/business/debug/app-business-debug.apk
- name: Upload to GitHub release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: WaEnhancer ${{ env.SHORT_SHA }}
body_path: changelog.txt
files: |
app/build/outputs/apk/whatsapp/debug/app-whatsapp-debug.apk
app/build/outputs/apk/business/debug/app-business-debug.apk
tag_name: debug-${{ env.SHORT_SHA }}
- name: Read changelog
if: ${{ success() && github.ref == 'refs/heads/master' && github.ref_type != 'tag' && env.BOT_TOKEN != '' }}
id: changelog
uses: actions/github-script@v8
with:
script: |
const fs = require('fs');
const changelog = fs.readFileSync('changelog.txt', 'utf8').trim();
core.setOutput('content', changelog);
- name: Post to Telegram channel
if: ${{ success() && github.ref == 'refs/heads/master' && github.ref_type != 'tag' && env.BOT_TOKEN != '' }}
uses: Dev4Mod/telegram-github-action@master
with:
to: ${{ env.CHANNEL_ID }}
token: ${{ env.BOT_TOKEN }}
format: markdown
disable_web_page_preview: true
message: |
${{ steps.changelog.outputs.content }}
Release: https://github.com/${{ github.repository }}/releases/tag/debug-${{ env.SHORT_SHA }}