-
Notifications
You must be signed in to change notification settings - Fork 198
87 lines (76 loc) · 2.82 KB
/
Copy pathrelease.yml
File metadata and controls
87 lines (76 loc) · 2.82 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
name: Release
on:
workflow_dispatch:
jobs:
release:
permissions: write-all
runs-on: ubuntu-latest
env:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- 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: Get version and SHA
id: vars
run: |
VERSION=$(grep 'versionName' app/build.gradle.kts | sed -n 's/.*versionName = "\([^ ]*\).*/\1/p')
SHA8=$(git rev-parse --short=8 HEAD)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=$VERSION-$SHA8" >> $GITHUB_OUTPUT
- name: Write key
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 variants
run: ./gradlew assembleWhatsappRelease assembleBusinessRelease
- name: Upload to GitHub release
uses: softprops/action-gh-release@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: WaEnhancer ${{ steps.vars.outputs.version }}
body_path: changelog.txt
files: |
app/build/outputs/apk/whatsapp/release/WaEnhancer*.apk
app/build/outputs/apk/business/release/WaEnhancer-Business*.apk
tag_name: ${{ steps.vars.outputs.tag }}
- name: Read changelog
id: changelog
uses: actions/github-script@v9
with:
script: |
const fs = require('fs');
const changelog = fs.readFileSync('changelog.txt', 'utf8').trim();
core.setOutput('content', changelog);
- name: Post to Telegram channel
if: ${{ 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/${{ steps.vars.outputs.tag }}