forked from Qsgs-Fans/FreeKill
-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (134 loc) · 4.4 KB
/
build-android.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
name: Build For Android
on:
workflow_dispatch:
push:
tags:
- '*'
jobs:
build:
name: Build Android APK
runs-on: ubuntu-latest
steps:
- name: Checkout Git Repo
uses: actions/checkout@v3
with:
submodules: true
#- name: Setup Debug Session
# uses: csexton/debugger-action@master
- name: Install swig
run: |
sudo apt-get install -y swig
- name: Install Qt for Host
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
py7zrversion: '>=0.20.2'
version: '6.5.3'
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
modules: 'qtmultimedia qt5compat qtshadertools'
- name: Install Qt for Android
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
py7zrversion: '>=0.20.2'
version: '6.5.3'
host: 'linux'
target: 'android'
arch: 'android_arm64_v8a'
modules: 'qtmultimedia qt5compat qtshadertools'
# 快点TM升级到OpenSSL 3!1.1.1今年就走到生命期末尾了!
- name: Setup OpenSSL 1.1.1 headers
run: |
cd ..
wget --quiet https://www.openssl.org/source/openssl-1.1.1t.tar.gz
tar xf ./openssl-1.1.1t.tar.gz
cd openssl-1.1.1t
./config
make include/openssl/opensslconf.h
cd ../FreeKill
cp -r ../openssl-1.1.1t/include/openssl ./include
- name: Setup Android for Qt
run: |
cd ..
mkdir android
cd android
wget --quiet https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
unzip commandlinetools-linux-9477386_latest.zip
yes | ./cmdline-tools/bin/sdkmanager --sdk_root=$(pwd) \
"platforms;android-33" \
"platform-tools" \
"build-tools;33.0.0" \
"ndk;25.1.8937393"
- name: Copy android assets
run: |
${Qt6_DIR}/../gcc_64/bin/lrelease lang/zh_CN.ts
${Qt6_DIR}/../gcc_64/bin/lrelease lang/en_US.ts
cp lang/zh_CN.qm .
cp lang/en_US.qm .
FKVER=$(cat CMakeLists.txt | grep 'project(FreeKill' | cut -d ' ' -f 3)
cd android
sed -i 's/function //g' copy_assets.sh # FIX THIS
./copy_assets.sh || echo "" # fail on copy cert, ubuntu is not arch
cd assets/res
cp -r /etc/ssl/certs .
cp /usr/share/ca-certificates/mozilla/* certs/
echo ${FKVER%)} > fk_ver
- name: Configure CMake Project
working-directory: ${{github.workspace}}
run: |
export QT_HOST_PATH=${Qt6_DIR}/../gcc_64/
export ANDROID_SDK_ROOT=$(pwd)/../android
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/25.1.8937393
sed -i "s/LinguistTools/Linguist/g" CMakeLists.txt
${Qt6_DIR}/bin/qt-cmake -S . -B ./build -DCMAKE_BUILD_TYPE=MinSizeRel
- name: Build project
working-directory: ${{github.workspace}}/build
run: make -j2
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: apk
path: build/android-build/build/outputs/apk/release/android-build-release-unsigned.apk
release:
name: Release APK
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Git Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Previous tag
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: 0.0.1
- name: Download APK from build
uses: actions/download-artifact@v3
with:
name: apk
path: apk
- uses: r0adkll/sign-android-release@v1
name: Sign app APK
# ID used to access action output
id: sign_app
with:
releaseDirectory: apk
signingKeyBase64: ${{ secrets.KEY_STORE }}
alias: ${{ secrets.KEY_STORE_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
env:
# override default build-tools version (29.0.3) -- optional
BUILD_TOOLS_VERSION: "33.0.0"
- name: Rename APK
run: |
mv ${{ steps.sign_app.outputs.signedReleaseFile }} \
apk/FreeKill-${{ steps.previoustag.outputs.tag }}.apk
- name: Upload Release APK
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.MY_TOKEN }}
tag_name: ${{ steps.previoustag.outputs.tag }}
files: apk/FreeKill-${{ steps.previoustag.outputs.tag }}.apk