2023-04-07 16:07:52 +08:00
|
|
|
|
name: Build For Android
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
workflow_dispatch:
|
2023-04-20 18:11:09 +08:00
|
|
|
|
push:
|
|
|
|
|
tags:
|
|
|
|
|
- '*'
|
2023-04-07 16:07:52 +08:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2023-08-26 07:37:04 +08:00
|
|
|
|
- name: Install swig
|
2023-04-07 16:07:52 +08:00
|
|
|
|
run: |
|
2023-08-26 07:37:04 +08:00
|
|
|
|
sudo apt-get install -y swig
|
2023-04-07 16:07:52 +08:00
|
|
|
|
|
|
|
|
|
- name: Install Qt for Host
|
|
|
|
|
uses: jurplel/install-qt-action@v3
|
|
|
|
|
with:
|
|
|
|
|
aqtversion: '==3.1.*'
|
|
|
|
|
py7zrversion: '>=0.20.2'
|
2023-11-07 21:31:07 +08:00
|
|
|
|
version: '6.5.3'
|
2023-04-07 16:07:52 +08:00
|
|
|
|
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'
|
2023-11-07 21:31:07 +08:00
|
|
|
|
version: '6.5.3'
|
2023-04-07 16:07:52 +08:00
|
|
|
|
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
|
|
|
|
|
|
2023-11-07 21:31:07 +08:00
|
|
|
|
- name: Setup Android for Qt
|
2023-04-07 16:07:52 +08:00
|
|
|
|
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) \
|
2023-11-07 21:31:07 +08:00
|
|
|
|
"platforms;android-33" \
|
2023-04-07 16:07:52 +08:00
|
|
|
|
"platform-tools" \
|
2023-11-07 21:31:07 +08:00
|
|
|
|
"build-tools;33.0.0" \
|
|
|
|
|
"ndk;25.1.8937393"
|
2023-04-07 16:07:52 +08:00
|
|
|
|
|
|
|
|
|
- name: Copy android assets
|
|
|
|
|
run: |
|
|
|
|
|
${Qt6_DIR}/../gcc_64/bin/lrelease lang/zh_CN.ts
|
2023-11-07 12:49:31 +08:00
|
|
|
|
${Qt6_DIR}/../gcc_64/bin/lrelease lang/en_US.ts
|
2023-04-07 16:07:52 +08:00
|
|
|
|
cp lang/zh_CN.qm .
|
2023-11-07 12:49:31 +08:00
|
|
|
|
cp lang/en_US.qm .
|
2023-04-07 16:07:52 +08:00
|
|
|
|
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/
|
2024-07-03 10:03:26 +08:00
|
|
|
|
curl https://raw.githubusercontent.com/Qsgs-Fans/freekill-server-list/master/server-list.json > server-list.json
|
2024-06-10 15:19:47 +08:00
|
|
|
|
cd ../..
|
|
|
|
|
echo ${FKVER%)} > ../fk_ver
|
|
|
|
|
../genfkver.sh
|
|
|
|
|
cp ../fk_ver assets/res
|
2023-04-07 16:07:52 +08:00
|
|
|
|
|
|
|
|
|
- name: Configure CMake Project
|
|
|
|
|
working-directory: ${{github.workspace}}
|
|
|
|
|
run: |
|
|
|
|
|
export QT_HOST_PATH=${Qt6_DIR}/../gcc_64/
|
|
|
|
|
export ANDROID_SDK_ROOT=$(pwd)/../android
|
2023-11-07 21:31:07 +08:00
|
|
|
|
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/25.1.8937393
|
2023-04-07 16:07:52 +08:00
|
|
|
|
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
|
2023-11-07 21:31:07 +08:00
|
|
|
|
path: build/android-build/build/outputs/apk/release/android-build-release-unsigned.apk
|
2023-04-07 16:07:52 +08:00
|
|
|
|
|
|
|
|
|
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
|
2023-11-07 21:31:07 +08:00
|
|
|
|
BUILD_TOOLS_VERSION: "33.0.0"
|
2023-04-07 16:07:52 +08:00
|
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
|