Files
CFA-builds/.gitea/workflows/build-ci.yaml
2026-05-05 23:25:13 +08:00

125 lines
3.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Build
on:
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
repository: 'lzw-723/ClashMetaForAndroid'
fetch-depth: 0
ref: 'main'
github-server-url: 'https://gitea.tunnel.litchi.quest'
- name: Checkout and Update submodules
run: git submodule update --init --recursive --remote --force
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
with:
cache-provider: basic
- name: Setup Android SDK
uses: android-actions/setup-android@v4
- name: Setup Go
uses: actions/setup-go@v6
with:
go-download-base-url: 'https://github.com/MetaCubeX/go/releases/download/build'
go-version: '1.26'
cache: false
- name: Apply Patches
run: |
cd $(go env GOROOT)
for p in $GITHUB_WORKSPACE/.github/patch/*.patch; do
# 检查是否已经包含了补丁中的关键改动(例如 runtime.GOOS == "android"
if ! grep -q 'runtime.GOOS == "android"' src/os/pidfd_linux.go; then
echo "Applying patch: $p"
patch -p1 < "$p"
else
echo "Patch $(basename $p) already applied, skipping."
fi
done
- name: Calculate go.sum hash
id: calc-hash
run: |
HASH=$(sha256sum $GITHUB_WORKSPACE/core/src/foss/golang/go.sum | cut -d ' ' -f 1)
echo "GOSUM_HASH=$HASH" >> $GITHUB_OUTPUT
- name: Cache Go modules
uses: actions/cache@v5
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ steps.calc-hash.outputs.GOSUM_HASH }}
restore-keys: |
${{ runner.os }}-go-
- name: Update CA
run: |
sudo apt-get update && sudo apt-get install ca-certificates
sudo update-ca-certificates
cp -f /etc/ssl/certs/ca-certificates.crt core/src/foss/golang/clash/component/ca/ca-certificates.crt
- name: Build
if: success()
run: ./gradlew --no-daemon app:assembleAlphaRelease
- name: Upload Aritfact (universal)
uses: https://gitea.com/actions/gitea-upload-artifact@v4
if: ${{ success() }}
with:
name: CMFA Debug Unsigned APK (universal)
path: |
app/build/outputs/apk/alpha/release/*-universal-*.apk
retention-days: 30
- name: Upload Aritfact (arm64-v8a)
uses: https://gitea.com/actions/gitea-upload-artifact@v4
if: ${{ success() }}
with:
name: CMFA Debug Unsigned APK (arm64-v8a)
path: |
app/build/outputs/apk/alpha/release/*-arm64-v8a-*.apk
retention-days: 30
- name: Upload Aritfact (armeabi-v7a)
uses: https://gitea.com/actions/gitea-upload-artifact@v4
if: ${{ success() }}
with:
name: CMFA Debug Unsigned APK (armeabi-v7a)
path: |
app/build/outputs/apk/alpha/release/*-armeabi-v7a-*.apk
retention-days: 30
- name: Upload Aritfact (x86_64)
uses: https://gitea.com/actions/gitea-upload-artifact@v4
if: ${{ success() }}
with:
name: CMFA Debug Unsigned APK (x86_64)
path: |
app/build/outputs/apk/alpha/release/*-x86_64-*.apk
retention-days: 30
- name: Upload Aritfact (x86)
uses: https://gitea.com/actions/gitea-upload-artifact@v4
if: ${{ success() }}
with:
name: CMFA Debug Unsigned APK (x86)
path: |
app/build/outputs/apk/alpha/release/*-x86-*.apk
retention-days: 30