Manually #107
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Manually | |
on: | |
workflow_dispatch | |
jobs: | |
build_pull_request: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-24.04 | |
#- macos-13 | |
#- windows-2022 | |
abi: | |
#- armeabi-v7a | |
- arm64-v8a | |
#- x86 | |
#- x86_64 | |
env: | |
BUILD_ABI: ${{ matrix.abi }} | |
steps: | |
- name: Fetch source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Regenerate symlinks pointing to submodule (Windows) | |
if: ${{ matrix.os == 'windows-2022' }} | |
run: | | |
Remove-Item -Recurse app/src/main/assets/usr/share, plugin/hangul/src/main/assets/usr/share/libhangul, plugin/chewing/src/main/assets/usr/share/libchewing, plugin/jyutping/src/main/assets/usr/share/libime | |
git checkout -- . | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Setup Android environment | |
uses: android-actions/setup-android@v3 | |
- name: Install Android NDK | |
run: | | |
sdkmanager --install "cmake;3.22.1" | |
- name: Install system dependencies (Ubuntu) | |
if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
run: | | |
sudo apt update | |
sudo apt install extra-cmake-modules gettext | |
#删除不需要的插件 | |
rm plugin/anthy -rf | |
# rm plugin/chewing -rf | |
rm plugin/hangul -rf | |
rm plugin/jyutping -rf | |
rm plugin/sayura -rf | |
rm plugin/thai -rf | |
rm plugin/unikey -rf | |
- name: Install system dependencies (macOS) | |
if: ${{ matrix.os == 'macos-13' }} | |
run: | | |
brew install extra-cmake-modules | |
- name: Install system dependencies (Windows) | |
if: ${{ matrix.os == 'windows-2022' }} | |
run: | | |
C:/msys64/usr/bin/pacman -S --noconfirm mingw-w64-ucrt-x86_64-gettext mingw-w64-ucrt-x86_64-extra-cmake-modules | |
Add-Content $env:GITHUB_PATH "C:/msys64/ucrt64/bin" | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Build release APK | |
run: | | |
./gradlew :app:assembleRelease | |
./gradlew :assembleReleasePlugins | |
- name: Sign app | |
uses: kevin-david/[email protected] | |
#uses: rpavlik/sign-android-release@master | |
id: sign_app | |
with: | |
releaseDirectory: app/build/outputs/apk/release/ | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
alias: ${{ secrets.KEY_ALIAS }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
zipAlign: true | |
env: | |
BUILD_TOOLS_VERSION: "34.0.0" | |
- name: Upload app | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-${{ matrix.os }}-${{ matrix.abi }} | |
path: app/build/outputs/apk/release/ | |
- name: Pack plugins | |
shell: bash | |
run: | | |
mkdir plugins-to-upload | |
find plugin/*/build/outputs/apk/release -type f -print0 | while IFS= read -r -d '' source_file; do | |
# 获取第二级目录名作为前缀 | |
prefix=$(basename "$(dirname "$(dirname "$(dirname "$(dirname "$(dirname "$source_file")")")")")") | |
# 获取文件名 | |
filename=$(basename "$source_file") | |
# 构建目标文件路径,加上前缀 | |
target_file="plugins-to-upload/$prefix"_"$filename" | |
mv "$source_file" "$target_file" | |
done | |
- name: Sign plugins | |
uses: kevin-david/[email protected] | |
#uses: rpavlik/sign-android-release@master | |
id: sign_plugins | |
with: | |
releaseDirectory: plugins-to-upload | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
alias: ${{ secrets.KEY_ALIAS }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
zipAlign: true | |
env: | |
BUILD_TOOLS_VERSION: "34.0.0" | |
- name: Upload plugins | |
uses: actions/upload-artifact@v4 | |
with: | |
name: plugins-${{ matrix.os }}-${{ matrix.abi }} | |
path: plugins-to-upload | |
- name: Upload APKs | |
uses: actions/upload-artifact@v4 | |
with: | |
path: | | |
app/build/outputs/apk/release/org.fcitx.fcitx5.android*-signed.apk | |
plugins-to-upload/rime*-signed.apk | |
plugins-to-upload/clipboard-filter*-signed.apk |