Skip to content

fix: add JitPack repository for material-about-library and Roomigrant #154

fix: add JitPack repository for material-about-library and Roomigrant

fix: add JitPack repository for material-about-library and Roomigrant #154

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches:
- main
env:
MIERU_VERSION: v3.34.1
MDVPN_REF: android-vpnservice-protect-hook
MDVPN_COMMIT: d481d72d4b86783a87d536c214d2c68cc4e9320e
NAIVE_VERSION: v149.0.7827.114-1
OLCRTC_REPO: https://github.com/hawkff/olcrtc.git
OLCRTC_COMMIT: ad5cc1e3d60b657b15ccd26f8db91395bf9630d0
permissions:
contents: read
jobs:
libcore:
name: Native Build (LibCore)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Golang Status
run: find buildScript libcore -type f -name "*.sh" | xargs cat | sha1sum > golang_status
- name: Libcore Status
run: git ls-files libcore | xargs cat | sha1sum > libcore_status
- name: LibCore Cache
id: cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
app/libs/libcore.aar
key: ${{ hashFiles('.github/workflows/*', 'golang_status', 'libcore_status') }}
- name: Install Golang
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version: '1.26.4'
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: ./run lib core
- name: Upload LibCore
uses: actions/upload-artifact@v4 # v1
with:
name: libcore-aar-build
path: app/libs/libcore.aar
retention-days: 1
if-no-files-found: error
sidecars:
name: Native Build (Sidecars)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Sidecars Status
run: |
git ls-files -s -- \
buildScript/lib/mieru.sh \
buildScript/lib/masterdnsvpn.sh \
buildScript/lib/naive.sh \
buildScript/lib/olcrtc.sh \
buildScript/lib/olcrtc-src/main.go \
buildScript/lib/olcrtc-src/main_test.go \
buildScript/lib/olcrtc-src/go.mod \
buildScript/init/env.sh \
buildScript/init/env_ndk.sh \
| sha1sum > sidecars_status
- name: Sidecars Cache
id: cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
app/executableSo
key: ${{ hashFiles('.github/workflows/*', 'sidecars_status') }}-${{ env.MIERU_VERSION }}-${{ env.MDVPN_COMMIT }}-${{ env.NAIVE_VERSION }}-${{ env.OLCRTC_COMMIT }}-sidecars
- name: Install Golang
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version: '1.26.4'
- name: Mieru Build
if: steps.cache.outputs.cache-hit != 'true'
run: ./run lib mieru
- name: MasterDnsVPN Build
if: steps.cache.outputs.cache-hit != 'true'
run: ./run lib masterdnsvpn
- name: Naive Download
if: steps.cache.outputs.cache-hit != 'true'
run: ./run lib naive
- name: olcRTC Build
if: steps.cache.outputs.cache-hit != 'true'
run: ./run lib olcrtc
- name: Upload Sidecars
uses: actions/upload-artifact@v4 # v1
with:
name: sidecars-so-build
path: app/executableSo
retention-days: 1
if-no-files-found: error
build:
name: Build OSS APK
runs-on: ubuntu-latest
needs:
- libcore
- sidecars
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Download LibCore
uses: actions/download-artifact@v4 # v1
with:
name: libcore-aar-build
path: app/libs
- name: Download Sidecars
uses: actions/download-artifact@v4 # v1
with:
name: sidecars-so-build
path: app/executableSo
- name: Verify Sidecar Artifacts
run: |
for abi in arm64-v8a armeabi-v7a x86 x86_64; do
for so in libmieru.so libmasterdnsvpn.so libnaive.so libolcrtc.so; do
if [ ! -f "app/executableSo/$abi/$so" ]; then
echo "Error: missing app/executableSo/$abi/$so (sidecar artifact missing)" >&2
exit 1
fi
done
done
- name: Gradle cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.gradle
key: gradle-oss-${{ hashFiles('**/*.gradle.kts') }}
- name: Gradle Build
env:
BUILD_PLUGIN: none
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
ALIAS_NAME: ${{ secrets.ALIAS_NAME }}
ALIAS_PASS: ${{ secrets.ALIAS_PASS }}
run: |
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/25.0.8775105" >> local.properties
if [ -z "$KEYSTORE_BASE64" ] || [ -z "$KEYSTORE_PASS" ] || [ -z "$ALIAS_NAME" ]; then
echo "::error:: 未設定簽名憑證!請在 GitHub Secrets 中設定 KEYSTORE_BASE64 / KEYSTORE_PASS / ALIAS_NAME / ALIAS_PASS"
exit 1
fi
echo "::notice:: 使用用戶自訂簽名 (alias=$ALIAS_NAME)"
# 從 GitHub Secrets 還原 keystore 檔案
echo "$KEYSTORE_BASE64" | base64 -d > release.keystore
# 執行初始化腳本
./run init action gradle
# 寫入簽名配置到 local.properties 供 Gradle 讀取
echo "KEYSTORE_PASS=$KEYSTORE_PASS" >> local.properties
echo "ALIAS_NAME=$ALIAS_NAME" >> local.properties
echo "ALIAS_PASS=$ALIAS_PASS" >> local.properties
# 使用用戶自訂 keystore 簽名打包
KEYSTORE_PASS="$KEYSTORE_PASS" ALIAS_NAME="$ALIAS_NAME" ALIAS_PASS="$ALIAS_PASS" \
./gradlew app:assembleOssRelease
# 5. 尋找 APK 路徑並寫入環境變量
APK=$(find app/build/outputs/apk -name '*arm64-v8a*.apk')
APK=$(dirname $APK)
echo "APK=$APK" >> $GITHUB_ENV
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: NekoBoxs
path: ${{ env.APK }}