forked from SagerNet/sing-box
-
Notifications
You must be signed in to change notification settings - Fork 72
138 lines (121 loc) · 4.85 KB
/
sfa.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Build SFA
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: get latest go version
id: go
run: |
echo version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/update-versions-manifest-file/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
- name: setup go
uses: actions/setup-go@v4.1.0
with:
go-version: ${{steps.go.outputs.version}}
- name: checkout app repository
uses: actions/checkout@v4.1.1
with:
path: sfa
repository: SagerNet/sing-box-for-android
submodules: recursive
- name: setup java
uses: actions/setup-java@v3
with:
distribution: 'oracle'
java-version: 20
- name: setup ndk
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r26b
- name: get latest build tools version
id: sdk
run: echo version=$(ls $ANDROID_HOME/build-tools | tail -n 1) >> $GITHUB_OUTPUT
- name: get sing-box version
id: sing-box
run: |
git remote add sekai https://github.com/SagerNet/sing-box
git fetch --tags sekai
version=$(CGO_ENABLED=0 go run ./cmd/internal/read_tag)
echo version=$version >> $GITHUB_OUTPUT
- name: build libbox
env:
CC: ${{steps.setup-ndk.outputs.ndk-path}}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android34-clang
TAGS: with_quic,with_dhcp,with_wireguard,with_shadowsocksr,with_ech,with_utls,with_clash_api,with_gvisor
VERSION: ${{steps.sing-box.outputs.version}}
CGO_ENABLED: '0'
run: |
make lib_install
gomobile bind -v -a -trimpath -androidapi 21 -javapkg=io.nekohasekai -libname=box -tags ${TAGS} -ldflags "-X github.com/sagernet/sing-box/constant.Version=${VERSION} -s -w -buildid=" ./experimental/libbox
- name: setup build env && build app
env:
VERSION: ${{steps.sing-box.outputs.version}}
KEYSTORE: ${{secrets.SIGN_KEY}}
ALIAS_NAME: ${{secrets.ALIAS}}
KEYSTORE_PASS: ${{secrets.SIGN_KEY}}
run: |
mkdir -p sfa/app/libs/
cp ./libbox.aar sfa/app/libs/
cd sfa
echo "" >> gradle.properties
echo "org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8 -XX:+UseParallelGC" >> gradle.properties
echo "org.gradle.caching=true" >> gradle.properties
echo "org.gradle.parallel=true" >> gradle.properties
echo "VERSION_NAME=${VERSION}" > local.properties
echo "VERSION_CODE=$(date +%Y%m%d%H)" >> local.properties
sed -i '/signingConfigs\.release/d' app/build.gradle
chmod +x ./gradlew
./gradlew assembleRelease --debug
- name: sign app
uses: PuerNya/sign-android-release@v2.0.4
env:
BUILD_TOOLS_VERSION: ${{steps.sdk.outputs.version}}
with:
alias: ${{secrets.ALIAS}}
releaseDirectory: sfa/app/build/outputs/apk/other/release
signingKeyBase64: ${{secrets.SIGN_KEY}}
keyStorePassword: ${{secrets.KEY_STORE_PASSWORD}}
- name: upload arm64-v8a apk
uses: actions/upload-artifact@v4.1.0
env:
version: ${{steps.sing-box.outputs.version}}
with:
name: sfa-${{env.version}}-arm64-v8a
path: sfa/app/build/outputs/apk/other/release/*-arm64-v8a-signed.apk
compression-level: 9
- name: upload armeabi-v7a apk
uses: actions/upload-artifact@v4.1.0
env:
version: ${{steps.sing-box.outputs.version}}
with:
name: sfa-${{env.version}}-armeabi-v7a
path: sfa/app/build/outputs/apk/other/release/*-armeabi-v7a-signed.apk
compression-level: 9
- name: upload x86_64 apk
uses: actions/upload-artifact@v4.1.0
env:
version: ${{steps.sing-box.outputs.version}}
with:
name: sfa-${{env.version}}-x86_64
path: sfa/app/build/outputs/apk/other/release/*-x86_64-signed.apk
compression-level: 9
- name: upload x86 apk
uses: actions/upload-artifact@v4.1.0
env:
version: ${{steps.sing-box.outputs.version}}
with:
name: sfa-${{env.version}}-x86
path: sfa/app/build/outputs/apk/other/release/*-x86-signed.apk
compression-level: 9
- name: upload universal apk
uses: actions/upload-artifact@v4.1.0
env:
version: ${{steps.sing-box.outputs.version}}
with:
name: sfa-${{env.version}}-universal
path: sfa/app/build/outputs/apk/other/release/*-universal-signed.apk
compression-level: 9