Skip to content

Build SFA

Build SFA #133

Workflow file for this run

name: Build SFA
on:
push:
jobs:
build:
runs-on: ubuntu-latest
env:
TAGS: "with_quic,with_dhcp,with_wireguard,with_shadowsocksr,with_ech,with_utls,with_reality_server,with_clash_api,with_v2ray_api,with_gvisor"
steps:
- uses: actions/checkout@v4.1.0
with:
fetch-depth: 0
- name: Get latest go version
id: go_version
run: |
echo go_version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/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: 1.21.1
- name: Checkout SFA Repository
uses: actions/checkout@v3
with:
repository: SagerNet/sing-box-for-android
path: SFA
submodules: recursive
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'oracle'
java-version: 20
- name: Build SFA
run: |
git remote add sekai https://github.com/SagerNet/sing-box
git fetch sekai
mkdir -p SFA/app/libs/
make lib_install
version=$(CGO_ENABLED=0 go run ./cmd/internal/read_tag)
CGO_ENABLED=0 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
cp ./libbox.aar SFA/app/libs/
cd SFA
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
- name: Sign SFA
uses: PuerNya/sign-android-release@v2
with:
releaseDirectory: SFA/app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGN_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
- name: Upload arm64-v8a artifact
uses: actions/upload-artifact@v3
with:
name: SFA-arm64-v8a
path: |
SFA/app/build/outputs/apk/release/*-arm64-v8a-signed.apk
SFA/app/build/outputs/apk/release/*-arm64-v8a-*-signed.apk
- name: Upload armeabi-v7a artifact
uses: actions/upload-artifact@v3
with:
name: SFA-armeabi-v7a
path: |
SFA/app/build/outputs/apk/release/*-armeabi-v7a-signed.apk
SFA/app/build/outputs/apk/release/*-armeabi-v7a-*-signed.apk
- name: Upload x86_64 artifact
uses: actions/upload-artifact@v3
with:
name: SFA-x86_64
path: |
SFA/app/build/outputs/apk/release/*-x86_64-signed.apk
SFA/app/build/outputs/apk/release/*-x86_64-*-signed.apk
- name: Upload x86 artifact
uses: actions/upload-artifact@v3
with:
name: SFA-x86
path: |
SFA/app/build/outputs/apk/release/*-x86-signed.apk
SFA/app/build/outputs/apk/release/*-x86-*-signed.apk
- name: Upload universal artifact
uses: actions/upload-artifact@v3
with:
name: SFA-universal
path: |
SFA/app/build/outputs/apk/release/*-universal-signed.apk
SFA/app/build/outputs/apk/release/*-universal-*-signed.apk