|
| 1 | +name: Release S-UI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "*" |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + platform: [amd64, arm64, arm] |
| 14 | + runs-on: ubuntu-20.04 |
| 15 | + steps: |
| 16 | + - name: Checkout repository |
| 17 | + |
| 18 | + |
| 19 | + - name: Setup Go |
| 20 | + |
| 21 | + with: |
| 22 | + go-version: '1.21' |
| 23 | + |
| 24 | + - name: Setup Node.js |
| 25 | + uses: actions/setup-node@v4 |
| 26 | + with: |
| 27 | + node-version: '20' |
| 28 | + registry-url: 'https://registry.npmjs.org' |
| 29 | + |
| 30 | + - name: Install dependencies for arm64 and arm |
| 31 | + if: matrix.platform == 'arm64' || matrix.platform == 'arm' |
| 32 | + run: | |
| 33 | + sudo apt-get update |
| 34 | + sudo apt install gcc-aarch64-linux-gnu |
| 35 | + if [ "${{ matrix.platform }}" == "arm" ]; then |
| 36 | + sudo apt install gcc-arm-linux-gnueabihf |
| 37 | + fi |
| 38 | +
|
| 39 | + - name: Build frontend |
| 40 | + run: | |
| 41 | + cd frontend |
| 42 | + npm install |
| 43 | + npm run build |
| 44 | + cd .. |
| 45 | + mv frontend/dist backend/web/html |
| 46 | +
|
| 47 | + - name: Set evironments |
| 48 | + run: | |
| 49 | + export CGO_ENABLED=1 |
| 50 | + export GOOS=linux |
| 51 | + export GOARCH=${{ matrix.platform }} |
| 52 | + if [ "${{ matrix.platform }}" == "arm64" ]; then |
| 53 | + export CC=aarch64-linux-gnu-gcc |
| 54 | + elif [ "${{ matrix.platform }}" == "arm" ]; then |
| 55 | + export CC=arm-linux-gnueabihf-gcc |
| 56 | + fi |
| 57 | +
|
| 58 | + - name: Build sing-box |
| 59 | + run: | |
| 60 | + git clone -b v1.8.5 https://github.com/SagerNet/sing-box |
| 61 | + cd sing-box |
| 62 | + go build -tags with_v2ray_api,with_clash_api,with_grpc,with_quic,with_ech -o sing-box ./cmd/sing-box |
| 63 | + cd .. |
| 64 | +
|
| 65 | + - name: Build s-ui |
| 66 | + run: | |
| 67 | + cd backend |
| 68 | + go build -o ../sui main.go |
| 69 | + cd .. |
| 70 | + |
| 71 | + mkdir s-ui |
| 72 | + cp sui s-ui/ |
| 73 | + cp s-ui.service s-ui/ |
| 74 | + cp sing-box.service s-ui/ |
| 75 | + mkdir s-ui/bin |
| 76 | + cp sing-box/sing-box s-ui/bin/ |
| 77 | + cp runSingbox.sh s-ui/bin/ |
| 78 | + |
| 79 | + - name: Package |
| 80 | + run: tar -zcvf s-ui-linux-${{ matrix.platform }}.tar.gz s-ui |
| 81 | + |
| 82 | + - name: Upload |
| 83 | + |
| 84 | + with: |
| 85 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 86 | + tag: ${{ github.ref }} |
| 87 | + file: s-ui-linux-${{ matrix.platform }}.tar.gz |
| 88 | + asset_name: s-ui-linux-${{ matrix.platform }}.tar.gz |
| 89 | + prerelease: true |
| 90 | + overwrite: true |
0 commit comments