117 lines
3.5 KiB
YAML
117 lines
3.5 KiB
YAML
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 patch --verbose -p 1 < "$p"; 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 |