forked from DrKLO/Telegram
-
Notifications
You must be signed in to change notification settings - Fork 90
162 lines (150 loc) · 5.98 KB
/
tandroid.yml
File metadata and controls
162 lines (150 loc) · 5.98 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Fork Client
on: [push]
jobs:
linux:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
attestations: write
strategy:
matrix:
type: [debug, release]
include:
- type: debug
afat: assembleAfatDebug
name: ""
updates: 1
- type: release
afat: assembleAfatRelease
name: " compressed"
updates: 1
steps:
- uses: actions/checkout@v3.1.0
with:
submodules: true
- name: Free up some disk space.
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
tool-cache: false
android: false
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: nttld/setup-ndk@v1.4.2
id: setup-ndk-r21e
with:
ndk-version: r21e
link-to-sdk: true
- uses: nttld/setup-ndk@v1.4.2
id: setup-ndk-r23c
with:
ndk-version: r23c
link-to-sdk: true
- name: Install NDK for the JNI build (ndkVersion).
run: yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" "ndk;27.2.12479018"
- name: Prepare additional build number.
env:
ADDITIONAL_BUILD: ${{ secrets.ADDITIONAL_BUILD_NUMBER }}
run: |
result=$((ADDITIONAL_BUILD / 10000))
echo "ADDITIONAL_BUILD_NUMBER = $result should be between 0 and 10!"
echo "ADDITIONAL_BUILD_NUMBER=$result" >> $GITHUB_ENV
echo "USER_REPO=$GITHUB_REPOSITORY" >> $GITHUB_ENV
echo "CHECK_UPDATES=${{ matrix.updates }}" >> $GITHUB_ENV
- name: Build.
run: |
###
vars=gradle.properties
echo "DUMMY_CONST=0" >> $vars
echo "org.gradle.workers.max=1" >> $vars
echo "APP_ID=${{ secrets.APP_ID }}" >> $vars
echo "APP_HASH=${{ secrets.APP_HASH }}" >> $vars
echo "RELEASE_KEY_PASSWORD=${{ secrets.ALIAS_PASS }}" >> $vars
echo "RELEASE_KEY_ALIAS=${{ secrets.ALIAS_NAME }}" >> $vars
echo "RELEASE_STORE_PASSWORD=${{ secrets.KEYSTORE_PASS }}" >> $vars
echo "ADDITIONAL_BUILD_NUMBER=$ADDITIONAL_BUILD_NUMBER" >> $vars
echo "USER_REPO=$USER_REPO" >> $vars
echo "CHECK_UPDATES=${{ matrix.updates }}" >> $vars
echo "USER_ID_OWNER=${{ secrets.USER_ID_OWNER }}" >> $vars
echo "UPDATE_CHANNEL_USERNAME=${{ secrets.UPDATE_CHANNEL_USERNAME }}" >> $vars
echo "LASTFM_API_KEY=${{ secrets.LASTFM_API_KEY }}" >> $vars
echo "LASTFM_API_SECRET=${{ secrets.LASTFM_API_SECRET }}" >> $vars
echo "NATIVE_DEPS_NDK_DIR=${{ steps.setup-ndk-r21e.outputs.ndk-path }}" >> $vars
###
echo $ADDITIONAL_BUILD_NUMBER
sudo apt update
sudo apt -y install ninja-build meson unzip pip gperf
./gradlew :TMessagesProj_App:${{ matrix.afat }}
#grep BUILD_VERSION_STRING TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java | cut -d'"' -f 2 > ver.txt
grep VERSION_NAME TMessagesProj/build/generated/source/buildConfig/${{ matrix.type }}/org/telegram/messenger/BuildConfig.java | cut -d'"' -f 2 > ver.txt
mkdir -p artifact
mv TMessagesProj_App/build/outputs/apk/afat/${{ matrix.type }}/app.apk app.apk
cp app.apk "artifact/ForkClient $(cat ver.txt)${{ matrix.name }}.apk"
mkdir -p tag_asset
cp app.apk "tag_asset/ForkClient_$(cat ver.txt)${{ matrix.name }}.apk"
# Upload to channel.
if [[ "${{ contains(github.event.head_commit.message, '[Release]') }}" == "true" ]]; then
set +x
pip install requests tgcrypto-pyrofork Kurigram
cp app.apk "ForkClient $(cat ver.txt)${{ matrix.name }}.apk"
echo "${{ secrets.BASE64_ZIP }}" | base64 --decode > output.zip
unzip -j output.zip -d .
ls
python3 upload.py
set -x
else
echo "Skipping channel upload (no [Release] marker in commit message)."
fi
###
echo "NEW_TAG_TEXT=$(cat ver.txt)" >> $GITHUB_ENV
tempVer=$(cat ver.txt)
tempVer=${tempVer::-2}
echo "NEW_OFFICIAL_TAG_TEXT=$tempVer" >> $GITHUB_ENV
- name: Attest build provenance
if: ${{ contains(github.event.head_commit.message, '[Release]') }}
uses: actions/attest-build-provenance@v2
with:
subject-path: 'artifact/*.apk'
- uses: actions/upload-artifact@master
name: Upload artifact
if: ${{ contains(github.event.head_commit.message, '[Release]') }}
with:
name: ForkClient-${{ matrix.type }}
path: artifact/
release:
name: Create Release.
needs: linux
if: ${{ contains(github.event.head_commit.message, '[Release]') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- name: Download debug artifact
uses: actions/download-artifact@v4.3.0
with:
name: ForkClient-debug
path: debug_asset
- name: Download release artifact
uses: actions/download-artifact@v4.3.0
with:
name: ForkClient-release
path: release_asset
- name: Get version info
run: |
find debug_asset -name "*.apk" | head -1 | sed 's/.*ForkClient //;s/\.apk//' > version.txt
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
echo "OFFICIAL_VERSION=$(cat version.txt | sed 's/..$//')" >> $GITHUB_ENV
- name: Create Release
uses: softprops/action-gh-release@v0.1.15
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
with:
draft: true
files: |
debug_asset/*
release_asset/*
tag_name: ${{ env.VERSION }}
name: "ForkClient ${{ env.VERSION }}"
body: "— Updated to ${{ env.OFFICIAL_VERSION }} build of the official Telegram."