2023-04-07 08:07:52 +00:00
|
|
|
|
name: Build For Android
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
workflow_dispatch:
|
2023-04-20 10:11:09 +00:00
|
|
|
|
push:
|
|
|
|
|
tags:
|
|
|
|
|
- '*'
|
2023-04-07 08:07:52 +00: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
|
|
|
|
|
|
|
|
|
|
- name: Install swig, flex, bison
|
|
|
|
|
run: |
|
|
|
|
|
sudo apt-get install -y swig flex bison
|
|
|
|
|
|
|
|
|
|
- name: Install Qt for Host
|
|
|
|
|
uses: jurplel/install-qt-action@v3
|
|
|
|
|
with:
|
|
|
|
|
aqtversion: '==3.1.*'
|
|
|
|
|
py7zrversion: '>=0.20.2'
|
|
|
|
|
version: '6.4.2'
|
|
|
|
|
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.4.2'
|
|
|
|
|
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 6.4.x
|
|
|
|
|
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-31" \
|
|
|
|
|
"platform-tools" \
|
|
|
|
|
"build-tools;31.0.0" \
|
|
|
|
|
"ndk;23.1.7779620"
|
|
|
|
|
|
|
|
|
|
- name: Copy android assets
|
|
|
|
|
run: |
|
|
|
|
|
${Qt6_DIR}/../gcc_64/bin/lrelease lang/zh_CN.ts
|
|
|
|
|
cp lang/zh_CN.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/23.1.7779620
|
|
|
|
|
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/debug/android-build-debug.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: "31.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
|
|
|
|
|
|