Skip to content

Commit

Permalink
Update build grpcwebproxy workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
fscarmen2 committed Dec 18, 2023
1 parent 05faae0 commit 135c39c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 57 deletions.
26 changes: 0 additions & 26 deletions .github/grpcwebproxy-releaser.yml

This file was deleted.

72 changes: 43 additions & 29 deletions .github/workflows/grpcwebproxy.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
with:
go-version: "1.21"

- name: Run GoReleaser
uses: goreleaser/[email protected]
- uses: wangyoucao577/[email protected]
with:
distribution: goreleaser
workdir: ${{ env.workdir }}
version: latest
args: release --rm-dist --snapshot

- name: Release binaries
uses: softprops/[email protected]
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/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: grpcwebproxy
files: ${{ env.workdir }}/dist/*.tar.gz
repository: ${{ github.repository }}
older-than-seconds: 3600
2 changes: 1 addition & 1 deletion dashboard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 135c39c

Please sign in to comment.