Skip to content

Commit bdaea65

Browse files
committed
[refactor|build] Refactor some implementations; update dependencies; add a GitHub action
1 parent e278088 commit bdaea65

File tree

82 files changed

+2603
-2203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+2603
-2203
lines changed

.github/workflows/pre_release.yml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Pre-Release
2+
3+
# Trigger
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- 'master'
9+
paths-ignore:
10+
- '**.md'
11+
- 'doc/**'
12+
- 'image/**'
13+
14+
jobs:
15+
build:
16+
name: Build
17+
runs-on: macos-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up JDK 17
22+
uses: actions/setup-java@v4
23+
with:
24+
distribution: 'adopt'
25+
java-version: '17'
26+
27+
- name: Setup Gradle
28+
uses: gradle/actions/setup-gradle@v4
29+
30+
- name: Checkout Secret
31+
uses: actions/checkout@v4
32+
with:
33+
repository: ${{ secrets.SECRET_REPO }}
34+
token: ${{ secrets.TOKEN }} # Repo token
35+
path: secret
36+
37+
# Prepare secret files
38+
- name: Copy Secret Files
39+
run: |
40+
cd secret/Raca
41+
cp key.jks ../..
42+
cp secret.gradle.kts ../..
43+
44+
# Clean secret files
45+
- name: Clean Temp Secret Files
46+
run: |
47+
rm -rf ./secret
48+
49+
# Build
50+
- name: Build with Gradle
51+
run: |
52+
bash ./gradlew assembleGitHubRelease
53+
54+
# Upload apk (arm64-v8a)
55+
- name: Upload Pre-Release Apk (arm64-v8a)
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: Pre-Release Apk (arm64-v8a)
59+
path: app/build/outputs/apk/GitHub/release/*arm64-v8a*.apk
60+
compression-level: 9
61+
62+
# Upload apk (armeabi-v7a)
63+
- name: Upload Pre-Release Apk (armeabi-v7a)
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: Pre-Release Apk (armeabi-v7a)
67+
path: app/build/outputs/apk/GitHub/release/*armeabi-v7a*.apk
68+
compression-level: 9
69+
70+
# Upload apk (x86_64)
71+
- name: Upload Pre-Release Apk (x86_64)
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: Pre-Release Apk (x86_64)
75+
path: app/build/outputs/apk/GitHub/release/*x86_64*.apk
76+
compression-level: 9
77+
78+
# Upload apk (x86)
79+
- name: Upload Pre-Release Apk (x86)
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: Pre-Release Apk (x86)
83+
path: |
84+
app/build/outputs/apk/GitHub/release/*x86*.apk
85+
!app/build/outputs/apk/GitHub/release/*x86_64*.apk
86+
compression-level: 9
87+
88+
# Upload apk (universal)
89+
- name: Upload Pre-Release Apk (universal)
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: Pre-Release Apk (universal)
93+
path: app/build/outputs/apk/GitHub/release/*universal*.apk
94+
compression-level: 9
95+
96+
# Upload mapping
97+
- name: Upload Pre-Release Mapping
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: Pre-Release Mapping
101+
path: app/build/outputs/mapping/GitHubRelease/mapping.txt
102+
compression-level: 9
103+
104+
# Get apk path
105+
- name: Get Pre-Release Apk File Path
106+
run: |
107+
echo "PRE_RELEASE_APK_ARM64_V8=$(find app/build/outputs/apk/GitHub/release -name '*arm64-v8a*.apk' -type f | head -1)" >> $GITHUB_ENV
108+
echo "PRE_RELEASE_APK_ARM_V7=$(find app/build/outputs/apk/GitHub/release -name '*armeabi-v7a*.apk' -type f | head -1)" >> $GITHUB_ENV
109+
echo "PRE_RELEASE_APK_X86_64=$(find app/build/outputs/apk/GitHub/release -name '*x86_64*.apk' -type f | head -1)" >> $GITHUB_ENV
110+
echo "PRE_RELEASE_APK_X86=$(find app/build/outputs/apk/GitHub/release -name '*x86*.apk' -type f | head -1)" >> $GITHUB_ENV
111+
echo "PRE_RELEASE_APK_UNIVERSAL=$(find app/build/outputs/apk/GitHub/release -name '*universal*.apk' -type f | head -1)" >> $GITHUB_ENV
112+
113+
# Send to Telegram
114+
- name: Post to Telegram Channel
115+
if: github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[skip_post]') == false
116+
env:
117+
CHANNEL_ID: ${{ secrets.TELEGRAM_TO }}
118+
BOT_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
119+
PRE_RELEASE_ARM64_V8: ${{ env.PRE_RELEASE_APK_ARM64_V8 }}
120+
PRE_RELEASE_ARM_V7: ${{ env.PRE_RELEASE_APK_ARM_V7 }}
121+
PRE_RELEASE_X86_64: ${{ env.PRE_RELEASE_APK_X86_64 }}
122+
PRE_RELEASE_X86: ${{ env.PRE_RELEASE_APK_X86 }}
123+
PRE_RELEASE_UNIVERSAL: ${{ env.PRE_RELEASE_APK_UNIVERSAL }}
124+
COMMIT_MESSAGE: |+
125+
GitHub New CI: Raca\
126+
127+
`${{ github.event.head_commit.message }}`
128+
129+
by `${{ github.event.head_commit.author.name }}`
130+
131+
Commit details [here](${{ github.event.head_commit.url }})
132+
run: |
133+
ESCAPED=`python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE"])))'`
134+
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%2Fpre_release_arm64_v8%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22%3A${ESCAPED}%7D%5D" -F pre_release_arm64_v8="@$PRE_RELEASE_ARM64_V8"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
local.properties
1111
/key.jks
1212
/gradle
13-
/secret.gradle
13+
/secret.gradle.kts
1414
/app/schemas

app/build.gradle

Lines changed: 0 additions & 155 deletions
This file was deleted.

0 commit comments

Comments
 (0)