1 file changed
+97
@@ -0,0 +1,97 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_tag:
|
||||
required: false
|
||||
type: string
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Golang
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Setup local go gitea registry
|
||||
run: |
|
||||
go env -w GOPRIVATE=192.168.1.33/*
|
||||
go env -w GOINSECURE=192.168.1.33/*
|
||||
|
||||
- name: Install gomobile
|
||||
run: |
|
||||
go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20260821190718-4776eadac327
|
||||
echo "$HOME/go/bin" >> $GITEA_PATH
|
||||
|
||||
- name: Download Android cmdline-tools
|
||||
run: |
|
||||
mkdir -p $HOME/sdk/cmdline-tools
|
||||
cd /tmp
|
||||
curl -fSL -o cmdline-tools.zip \
|
||||
https://dl.google.com/android/repository/commandlinetools-linux-14742923_latest.zip
|
||||
unzip -q cmdline-tools.zip -d $HOME/sdk/cmdline-tools
|
||||
mv $HOME/sdk/cmdline-tools/cmdline-tools $HOME/sdk/cmdline-tools/latest
|
||||
echo "ANDROID_HOME=$HOME/sdk" >> $GITEA_ENV
|
||||
echo "$HOME/sdk/cmdline-tools/latest/bin" >> $GITEA_PATH
|
||||
echo "$HOME/sdk/platform-tools" >> $GITEA_PATH
|
||||
|
||||
- name: Accept licenses & install packages
|
||||
env:
|
||||
JAVA_TOOL_OPTIONS: "-DsocksProxyHost=xray -DsocksProxyPort=10808"
|
||||
run: |
|
||||
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY \
|
||||
-u http_proxy -u https_proxy -u all_proxy \
|
||||
bash -c 'yes | sdkmanager --licenses --verbose || test $? -eq 141'
|
||||
|
||||
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY \
|
||||
-u http_proxy -u https_proxy -u all_proxy \
|
||||
sdkmanager --verbose \
|
||||
"platforms;android-37.0" "build-tools;37.0.0" "platform-tools"
|
||||
|
||||
- name: Install NDK
|
||||
env:
|
||||
JAVA_TOOL_OPTIONS: "-DsocksProxyHost=xray -DsocksProxyPort=10808"
|
||||
run: |
|
||||
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY \
|
||||
-u http_proxy -u https_proxy -u all_proxy \
|
||||
sdkmanager --channel=0 --install "ndk;29.0.14206865"
|
||||
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/29.0.14206865" >> $GITEA_ENV
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p assets data
|
||||
bash gen_assets.sh download
|
||||
cp -v data/*.dat assets/
|
||||
gomobile init
|
||||
go mod tidy
|
||||
gomobile bind -v -androidapi 24 -trimpath -ldflags='-s -w -buildid= -checklinkname=0' ./
|
||||
|
||||
- name: Upload build artifacts
|
||||
if: github.event.inputs.release_tag == ''
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: libv2ray
|
||||
path: |
|
||||
${{ github.workspace }}/libv2ray*r
|
||||
|
||||
- name: Upload AndroidLibXrayLite to release
|
||||
if: github.event.inputs.release_tag != ''
|
||||
uses: actions/gitea-release-action@v1
|
||||
with:
|
||||
files: |-
|
||||
./libv2ray*.aar
|
||||
./libv2ray*.jar
|
||||
tag_name: ${{ github.event.inputs.release_tag }}
|
||||
Reference in new issue
Block a user