v0.0.3 #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release S-UI | |
on: | |
push: | |
tags: | |
- "*" | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
platform: | |
- amd64 | |
- arm64 | |
- armv7 | |
- 386 | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
cache: false | |
go-version: '1.22' | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: | | |
sudo apt-get update && sudo apt-get install upx -yq | |
if [ "${{ matrix.platform }}" == "arm64" ]; then | |
sudo apt install gcc-aarch64-linux-gnu | |
elif [ "${{ matrix.platform }}" == "armv7" ]; then | |
sudo apt install gcc-arm-linux-gnueabihf | |
elif [ "${{ matrix.platform }}" == "386" ]; then | |
sudo apt install gcc-i686-linux-gnu | |
fi | |
- name: Build frontend | |
run: | | |
cd frontend | |
npm install | |
npm run build | |
cd .. | |
mv frontend/dist backend/web/html | |
- name: Build s-ui & singbox | |
run: | | |
export CGO_ENABLED=1 | |
export GOOS=linux | |
export GOARCH=${{ matrix.platform }} | |
if [ "${{ matrix.platform }}" == "arm64" ]; then | |
export GOARCH=arm64 | |
export CC=aarch64-linux-gnu-gcc | |
elif [ "${{ matrix.platform }}" == "armv7" ]; then | |
export GOARCH=arm | |
export GOARM=7 | |
export CC=arm-linux-gnueabihf-gcc | |
elif [ "${{ matrix.platform }}" == "386" ]; then | |
export GOARCH=386 | |
export CC=i686-linux-gnu-gcc | |
fi | |
#### Build Sing-Box | |
git clone -b v1.8.13 https://github.com/SagerNet/sing-box | |
cd sing-box | |
go build -v -gcflags=all="-l -B -C" -mod=mod -trimpath \ | |
-ldflags "-s -w -buildid= -extldflags '-static'" -a \ | |
-tags='netgo osusergo static_build with_quic with_grpc with_wireguard with_ech with_utls with_reality_server with_acme with_v2ray_api with_clash_api with_gvisor' \ | |
-o sing-box ./cmd/sing-box | |
upx --ultra-brute -9 -v --lzma --best --force sing-box | |
cd .. | |
### Build s-ui | |
cd backend | |
go build -v -gcflags=all="-l -B -C" -mod=mod -trimpath \ | |
-ldflags "-s -w -buildid= -extldflags '-static'" -a -tags='netgo osusergo static_build sqlite_omit_load_extension' \ | |
-o ../sui main.go | |
cd .. | |
upx --ultra-brute -9 -v --lzma --best --force sui | |
mkdir s-ui | |
cp sui s-ui/ | |
cp s-ui.service s-ui/ | |
cp sing-box.service s-ui/ | |
mkdir s-ui/bin | |
cp sing-box/sing-box s-ui/bin/ | |
cp core/runSingbox.sh s-ui/bin/ | |
- name: Package | |
run: tar -zcvf s-ui-linux-${{ matrix.platform }}.tar.gz s-ui | |
- name: Upload | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref }} | |
file: s-ui-linux-${{ matrix.platform }}.tar.gz | |
asset_name: s-ui-linux-${{ matrix.platform }}.tar.gz | |
prerelease: true | |
overwrite: true |