-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (134 loc) · 6.02 KB
/
build-release.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
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
163
164
name: Build and Release OctoGram
on:
workflow_dispatch:
inputs:
variant:
type: choice
description: Choose whether to build a PBeta, Release, or Debug APK.
options:
- pbeta
- release
- debug
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Set up Android NDK
run: |
# Source: https://github.com/forkgram/TelegramAndroid/blob/e68ea253f7c517da34a853e52d33606a34c6dc3d/.github/workflows/tandroid.yml#L47
# Set up Android NDK
ANDROID_ROOT=/usr/local/lib/android
ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
echo "y" | $SDKMANAGER "ndk;21.4.7075529"
# Accept Android SDK licenses
yes | $ANDROID_HOME/tools/bin/sdkmanager --sdk_root=$ANDROID_HOME --licenses
- name: Clone OctoGramApp/OctoGram
run: |
git clone https://github.com/OctoGramApp/OctoGram --depth=1
- name: Clone Lyceris-chan/OctoGramBuilderSecrets
uses: GuillaumeFalourd/[email protected]
with:
owner: 'Lyceris-chan'
repository: 'OctoGramBuilderSecrets'
access-token: ${{ secrets.ACCESS_TOKEN }}
- name: Setup private secrets
run: |
mv OctoGramBuilderSecrets/BuildVars.java OctoGram/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
mv OctoGramBuilderSecrets/google-services.json OctoGram/TMessagesProj_App/google-services.json
mv OctoGramBuilderSecrets/local.properties OctoGram/local.properties
mv OctoGramBuilderSecrets/signing.properties OctoGram/signing.properties
mv OctoGramBuilderSecrets/OctoGramBuilderSecret.jks OctoGram/TMessagesProj_App/OctoGramBuilderSecret.jks
- name: Change ccache binary permissions
run: |
cd OctoGram
chmod 777 Tools/ccache/linux/ccache
- name: Retrieve OctoGramApp/OctoGram HEAD commit hash
id: save-hash
run: |
cd OctoGram
hash=$(git rev-parse --short HEAD)
echo "hash=$hash" >> "$GITHUB_OUTPUT"
- name: Restore build cache from release
run: |
url="https://github.com/Lyceris-chan/OctoGramBuilder/releases/download/BuildCache/cache.tzst"
if curl --output /dev/null --silent --head --fail "$url"; then
echo "File exists. Downloading..."
curl -L -o cache.tzst "$url"
/usr/bin/tar --posix -xf cache.tzst
sudo rsync -a --ignore-existing home/ /home/
rm -r home
rm cache.tzst
else
echo "File does not exist."
fi
- name: Notify Telegram - Build started
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TG_CHAT_ID }}
token: ${{ secrets.TG_TOKEN }}
format: markdown
disable_web_page_preview: true
message: |
**🔧 OctoGram CI Update:**
⚙️ Build initiated against commit: [${{ steps.save-hash.outputs.hash }}](https://github.com/OctoGramApp/OctoGram/commits/${{ steps.save-hash.outputs.hash }}).
🏗️ Build variant: ${{ github.event.inputs.variant }}
🔍 This is run: [#${{ github.run_number }}](${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}).
📜 Explore the complete commit history on [GitHub](https://github.com/OctoGramApp/OctoGram/commits/revamp).
- name: Build release APK
run: |
cd OctoGram
./gradlew TMessagesProj_App:assemble${{ github.event.inputs.variant }} --parallel --no-configuration-cache --max-workers=$(nproc)
- name: Archive build cache
run: |
echo "/home/runner/.cache/ccache" > manifest.txt
echo "/home/runner/work/OctoGramBuilder/OctoGramBuilder/OctoGram/TMessagesProj/.cxx" >> manifest.txt
/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P --files-from manifest.txt --use-compress-program zstdmt
- name: Upload build cache
uses: maggie0002/actions/packages/automatic-releases@built-packages
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: "BuildCache"
prerelease: false
title: "💾 OctoGram build cache"
files: |
cache.tzst
- name: Upload OctoGram release
uses: maggie0002/actions/packages/automatic-releases@built-packages
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: "OctoGram_${{ steps.save-hash.outputs.hash }}"
prerelease: false
title: "🐙 OctoGram build: ${{ github.event.inputs.variant }}"
files: |
OctoGram/TMessagesProj_App/build/outputs/apk/${{ github.event.inputs.variant }}/*.apk
notify:
name: Notify
needs: [build]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check workflow status
uses: martialonline/workflow-status@v4
id: check
- name: Notify Telegram - Build status
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TG_CHAT_ID }}
token: ${{ secrets.TG_TOKEN }}
format: markdown
disable_web_page_preview: true
message: |
🔧 OctoGram CI Status Update:
⚙️ Status: ${{ steps.check.outputs.status }}
🏗️ Build variant: ${{ github.event.inputs.variant }}
🔍 This is run: [#${{ github.run_number }}](${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}).
✅ If the build was successful, you can find the release here:
📦 https://github.com/Lyceris-chan/OctoGramBuilder/releases/latest