diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml new file mode 100644 index 00000000..d2327093 --- /dev/null +++ b/.github/workflows/build-all.yaml @@ -0,0 +1,96 @@ +name: Build FRP Binaries + +on: + push: + branches: + - '**' + tags: + - '**' + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + name: Build FRP ${{ matrix.goos }}-${{ matrix.goarch }} + runs-on: ubuntu-latest + + strategy: + matrix: + goos: [linux, windows, darwin, freebsd, openbsd, android] + goarch: [amd64, arm, arm64] + exclude: + - goos: darwin + goarch: arm + - goos: freebsd + goarch: arm + - goos: openbsd + goarch: arm + - goos: android + goarch: amd64 + + steps: + - name: Checkout source + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y zip tar make gcc g++ upx + + - name: Build FRP for ${{ matrix.goos }}-${{ matrix.goarch }} + run: | + mkdir -p release/packages + + echo "Building for ${{ matrix.goos }}-${{ matrix.goarch }}" + + # 构建版本号 + make + version=$(./bin/frps --version) + echo "Detected version: $version" + + export GOOS=${{ matrix.goos }} + export GOARCH=${{ matrix.goarch }} + export CGO_ENABLED=0 + + # 构建可执行文件 + make frpc frps + + out_dir="release/packages/frp_${version}_${{ matrix.goos }}_${{ matrix.goarch }}" + mkdir -p "$out_dir" + + if [ "${{ matrix.goos }}" = "windows" ]; then + mv ./bin/frpc.exe "$out_dir/frpc.exe" + mv ./bin/frps.exe "$out_dir/frps.exe" + else + mv ./bin/frpc "$out_dir/frpc" + mv ./bin/frps "$out_dir/frps" + fi + + cp LICENSE "$out_dir" + cp -f conf/frpc.toml "$out_dir" + cp -f conf/frps.toml "$out_dir" + + cd release/packages + if [ "${{ matrix.goos }}" = "windows" ]; then + zip -rq frp_${version}_${{ matrix.goos }}_${{ matrix.goarch }}.zip frp_${version}_${{ matrix.goos }}_${{ matrix.goarch }} + else + tar -zcf frp_${version}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz frp_${version}_${{ matrix.goos }}_${{ matrix.goarch }} + fi + cd ../../ + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: frp_${{ matrix.goos }}_${{ matrix.goarch }} + path: | + release/packages/frp_* + retention-days: 7 \ No newline at end of file diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index eb631c24..1cd230b0 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -23,4 +23,4 @@ jobs: uses: golangci/golangci-lint-action@v8 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v2.3 + version: v2.3 \ No newline at end of file