diff --git a/.github/grpcwebproxy-releaser.yml b/.github/grpcwebproxy-releaser.yml deleted file mode 100644 index 418ebc0..0000000 --- a/.github/grpcwebproxy-releaser.yml +++ /dev/null @@ -1,26 +0,0 @@ -project_name: Build grpcwebproxy -before: - hooks: - - go mod tidy -v -builds: - - env: - - CGO_ENABLED=0 - ldflags: - - -s -w -X main.version={{.Version}} -X main.arch={{.Arch}} - goos: - - linux - goarch: - - amd64 - - arm64 - - arm - gomips: - - softfloat - main: ./go/grpcwebproxy/ - binary: grpcwebproxy -universal_binaries: - - name_template: "grpcwebproxy" - replace: false -archives: - - name_template: "grpcwebproxy_{{ .Os }}_{{ .Arch }}" - files: - - none* \ No newline at end of file diff --git a/.github/workflows/grpcwebproxy.yml b/.github/workflows/grpcwebproxy.yml index 169b118..f0045b4 100644 --- a/.github/workflows/grpcwebproxy.yml +++ b/.github/workflows/grpcwebproxy.yml @@ -1,44 +1,58 @@ name: Cross compile grpcwebproxy on: + push: + tags: + - 'grpcwebproxy*' workflow_dispatch: +# push: +# branches: +# - main jobs: - grpcwebproxy: - - name: Cross compile grpcwebproxy - - runs-on: ubuntu-20.04 - + releases-matrix: + name: Release Go Binary + runs-on: ubuntu-latest env: - workdir: ./grpcwebproxy-source + CGO_ENABLED: 0 + BINARY: grpcwebproxy + + strategy: + matrix: + goos: [linux] + goarch: ["386", amd64, arm64, arm, s390x, riscv64] +# exclude: +# - goarch: "386" +# goos: darwin +# - goarch: arm64 +# goos: windows steps: - - name: Checkout code + - name: Git clone repository uses: actions/checkout@v4.1.1 with: + repository: improbable-eng/grpc-web fetch-depth: 1 - - name: Git clone grpcwebproxy - run: | - git clone https://github.com/improbable-eng/grpc-web.git ${{ env.workdir }} - cp ./.github/grpcwebproxy-releaser.yml ${{ env.workdir }}/.goreleaser.yml - - - name: Set up GoReleaser - uses: actions/setup-go@v4.1.0 - with: - go-version: "1.21" - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v5.0.0 + - uses: wangyoucao577/go-release-action@v1.41 with: - distribution: goreleaser - workdir: ${{ env.workdir }} - version: latest - args: release --rm-dist --snapshot - - - name: Release binaries - uses: softprops/action-gh-release@v0.1.15 + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: ${{ matrix.goos }} + goarch: ${{ matrix.goarch }} + goversion: "1.21.5" + project_path: "go/${{ env.BINARY }}" + ldflags: -s -w --extldflags '-static -fpic' + md5sum: "FALSE" + release_tag: "${{ env.BINARY }}" + release_name: "${{ env.BINARY }}" + binary_name: "${{ env.BINARY }}" + compress_assets: "AUTO" + asset_name: "${{ env.BINARY }}-${{ matrix.goos }}-${{ matrix.goarch }}" + + - name: Delete old workflow runs + uses: MajorScruffy/delete-old-workflow-runs@v0.3.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: grpcwebproxy - files: ${{ env.workdir }}/dist/*.tar.gz \ No newline at end of file + repository: ${{ github.repository }} + older-than-seconds: 3600 \ No newline at end of file diff --git a/dashboard.sh b/dashboard.sh index 5242fa6..83681ad 100644 --- a/dashboard.sh +++ b/dashboard.sh @@ -372,7 +372,7 @@ http { } EOF elif [ "$REVERSE_PROXY_MODE" = 'grpcwebproxy' ]; then - wget -c ${GH_PROXY}https://github.com/fscarmen2/Argo-Nezha-Service-Container/releases/download/grpcwebproxy/grpcwebproxy_linux_$ARCH.tar.gz -qO- | tar xz -C $TEMP_DIR >/dev/null 2>&1 + wget -c ${GH_PROXY}https://github.com/fscarmen2/Argo-Nezha-Service-Container/releases/download/grpcwebproxy/grpcwebproxy-linux-$ARCH.tar.gz -qO- | tar xz -C $TEMP_DIR >/dev/null 2>&1 chmod +x $TEMP_DIR/grpcwebproxy GRPC_PROXY_RUN="nohup ${WORK_DIR}/grpcwebproxy --run_http_server=false --server_tls_cert_file=${WORK_DIR}/nezha.pem --server_tls_key_file=${WORK_DIR}/nezha.key --server_http_tls_port=$GRPC_PROXY_PORT --backend_addr=localhost:${GRPC_PORT} --backend_tls_noverify --server_http_max_read_timeout=300s --server_http_max_write_timeout=300s >/dev/null 2>&1 &" fi diff --git a/init.sh b/init.sh index 71e47d3..8ec6aaf 100644 --- a/init.sh +++ b/init.sh @@ -41,7 +41,7 @@ if [ ! -s /etc/supervisor/conf.d/damon.conf ]; then # 用户选择使用 gRPC 反代方式: Nginx / Caddy / grpcwebproxy,默认为 Caddy;如需使用 grpcwebproxy,把 REVERSE_PROXY_MODE 的值设为 nginx 或 grpcwebproxy if [ "$REVERSE_PROXY_MODE" = 'grpcwebproxy' ]; then - wget -c ${GH_PROXY}https://github.com/fscarmen2/Argo-Nezha-Service-Container/releases/download/grpcwebproxy/grpcwebproxy_linux_$ARCH.tar.gz -qO- | tar xz -C $WORK_DIR + wget -c ${GH_PROXY}https://github.com/fscarmen2/Argo-Nezha-Service-Container/releases/download/grpcwebproxy/grpcwebproxy-linux-$ARCH.tar.gz -qO- | tar xz -C $WORK_DIR chmod +x $WORK_DIR/grpcwebproxy GRPC_PROXY_RUN="$WORK_DIR/grpcwebproxy --server_tls_cert_file=$WORK_DIR/nezha.pem --server_tls_key_file=$WORK_DIR/nezha.key --server_http_tls_port=$GRPC_PROXY_PORT --backend_addr=localhost:$GRPC_PORT --backend_tls_noverify --server_http_max_read_timeout=300s --server_http_max_write_timeout=300s" elif [ "$REVERSE_PROXY_MODE" = 'nginx' ]; then