新建Build action
This commit is contained in:
70
.github/workflows/build.yml
vendored
Normal file
70
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
name: Build APK
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '17'
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
run: |
|
||||||
|
java --version
|
||||||
|
|
||||||
|
- name: Setup Golang
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: '1.19.11'
|
||||||
|
|
||||||
|
- name: Install gomobile
|
||||||
|
run: |
|
||||||
|
go install golang.org/x/mobile/cmd/gomobile@latest
|
||||||
|
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
|
||||||
|
- name: Setup Rust
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: 1.48.0
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: Setup Android environment
|
||||||
|
uses: android-actions/setup-android@v2
|
||||||
|
with:
|
||||||
|
api-level: 30
|
||||||
|
target-platform: 'x86_64'
|
||||||
|
|
||||||
|
|
||||||
|
- 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 19 -ldflags='-s -w' ./
|
||||||
|
cp *.aar ${{ github.workspace }}/V2rayNG/app/libs/
|
||||||
|
|
||||||
|
- name: Build APK
|
||||||
|
run: |
|
||||||
|
cd ${{ github.workspace }}/V2rayNG
|
||||||
|
chmod 777 *
|
||||||
|
sed -i 's/org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8/org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8/' ${{ github.workspace }}/V2rayNG/gradle.properties
|
||||||
|
./gradlew assembleDebug
|
||||||
|
|
||||||
|
- name: Upload APK
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: apk
|
||||||
|
path: ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/dev/debug/
|
||||||
Reference in New Issue
Block a user