* refine upload-artifact and fix api version * refine upload-artifact and fix api version * refine upload-artifact and fix version * use Dependabot keep actions updated to latest like: v2-->v3
87 lines
2.5 KiB
YAML
87 lines
2.5 KiB
YAML
name: Build APK
|
|
|
|
on:
|
|
push:
|
|
workflow_dispatch:
|
|
inputs:
|
|
XRAY_CORE_VERSION:
|
|
description: 'Xray core version or commit hash'
|
|
required: false
|
|
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '17'
|
|
|
|
- name: Setup Golang
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.23.2'
|
|
|
|
- name: Install gomobile
|
|
run: |
|
|
go install golang.org/x/mobile/cmd/gomobile@latest
|
|
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
|
|
|
- name: Setup Android environment
|
|
uses: android-actions/setup-android@v3
|
|
|
|
- name: Build dependencies
|
|
run: |
|
|
mkdir ${{ github.workspace }}/build
|
|
cd ${{ github.workspace }}/build
|
|
git clone --depth=1 -b main https://github.com/2dust/AndroidLibXrayLite.git
|
|
cd AndroidLibXrayLite
|
|
go get github.com/xtls/xray-core@${{ github.event.inputs.XRAY_CORE_VERSION }} || true
|
|
gomobile init
|
|
go mod tidy -v
|
|
gomobile bind -v -androidapi 21 -ldflags='-s -w' ./
|
|
cp *.aar ${{ github.workspace }}/V2rayNG/app/libs/
|
|
|
|
- name: Build APK
|
|
run: |
|
|
cd ${{ github.workspace }}/V2rayNG
|
|
chmod 755 gradlew
|
|
./gradlew assembleDebug
|
|
|
|
- name: Upload arm64-v8a APK
|
|
uses: actions/upload-artifact@v4
|
|
if: ${{ success() }}
|
|
with:
|
|
name: arm64-v8a
|
|
path: ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/debug/*arm64-v8a*.apk
|
|
|
|
- name: Upload armeabi-v7a APK
|
|
uses: actions/upload-artifact@v4
|
|
if: ${{ success() }}
|
|
with:
|
|
name: armeabi-v7a
|
|
path: ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/debug/*armeabi-v7a*.apk
|
|
|
|
- name: Upload x86 APK
|
|
uses: actions/upload-artifact@v4
|
|
if: ${{ success() }}
|
|
with:
|
|
name: x86-apk
|
|
path: ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/debug/*x86*.apk
|
|
|
|
- name: Upload Other APKs
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: others-apk
|
|
path: |
|
|
${{ github.workspace }}/V2rayNG/app/build/outputs/apk/debug
|
|
!${{ github.workspace }}/V2rayNG/app/build/outputs/apk/debug/*arm64-v8a*.apk
|
|
!${{ github.workspace }}/V2rayNG/app/build/outputs/apk/debug/*armeabi-v7a*.apk
|
|
!${{ github.workspace }}/V2rayNG/app/build/outputs/apk/debug/*x86*.apk
|