85 lines
2.6 KiB
YAML
85 lines
2.6 KiB
YAML
name: Build APK
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
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: '21'
|
|
|
|
- name: Setup Golang
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.23.4'
|
|
cache: false
|
|
|
|
- name: Patch Go use 600296
|
|
#https://go-review.googlesource.com/c/go/+/600296
|
|
run: |
|
|
cd "$(go env GOROOT)"
|
|
curl "https://go-review.googlesource.com/changes/go~600296/revisions/5/patch" | base64 -d | patch --verbose -p 1
|
|
|
|
- name: Install gomobile
|
|
run: |
|
|
go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20240806205939-81131f6468ab
|
|
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
|
|
gomobile init
|
|
go mod tidy -v
|
|
gomobile bind -v -androidapi 21 -ldflags='-s -w' ./
|
|
cp *.aar ${{ github.workspace }}/V2rayNG/app/libs/
|
|
|
|
- name: Decode Keystore
|
|
uses: timheuer/base64-to-file@v1
|
|
id: android_keystore
|
|
with:
|
|
fileName: "android_keystore.jks"
|
|
encodedString: ${{ secrets.APP_KEYSTORE_BASE64 }}
|
|
|
|
- name: Build APK
|
|
run: |
|
|
cd ${{ github.workspace }}/V2rayNG
|
|
chmod 755 gradlew
|
|
./gradlew assembleRelease -Pandroid.injected.signing.store.file=${{ steps.android_keystore.outputs.filePath }} -Pandroid.injected.signing.store.password=${{ secrets.APP_KEYSTORE_PASSWORD }} -Pandroid.injected.signing.key.alias=${{ secrets.APP_KEYSTORE_ALIAS }} -Pandroid.injected.signing.key.password=${{ secrets.APP_KEY_PASSWORD }}
|
|
|
|
- name: Upload arm64-v8a APK
|
|
uses: actions/upload-artifact@v4
|
|
if: ${{ success() }}
|
|
with:
|
|
name: arm64-v8a
|
|
path: ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/release/*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/release/*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/release/*x86*.apk |