diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c67b045..c2f5b4c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,12 +18,29 @@ env: CARGO_REGISTRY: sparse+https://rsproxy.cn/index/ APT_MIRROR: https://mirrors.ustc.edu.cn/debian CARGO_TERM_COLOR: always + HTTP_PROXY: http://172.17.0.1:1082 + HTTPS_PROXY: http://172.17.0.1:1082 + ALL_PROXY: http://172.17.0.1:1082 + NO_PROXY: localhost,127.0.0.1,::1,172.17.0.1,git.pchuan.top,.pchuan.top + http_proxy: http://172.17.0.1:1082 + https_proxy: http://172.17.0.1:1082 + all_proxy: http://172.17.0.1:1082 + no_proxy: localhost,127.0.0.1,::1,172.17.0.1,git.pchuan.top,.pchuan.top jobs: prepare-release: name: Prepare release runs-on: ubuntu-latest steps: + - name: Configure network proxy + shell: bash + run: | + set -euo pipefail + + git config --global http.proxy "${HTTPS_PROXY}" + git config --global https.proxy "${HTTPS_PROXY}" + git config --global http.noProxy "${NO_PROXY}" + - name: Checkout uses: actions/checkout@v4 with: @@ -102,6 +119,15 @@ jobs: runs-on: ubuntu-latest needs: prepare-release steps: + - name: Configure network proxy + shell: bash + run: | + set -euo pipefail + + git config --global http.proxy "${HTTPS_PROXY}" + git config --global https.proxy "${HTTPS_PROXY}" + git config --global http.noProxy "${NO_PROXY}" + - name: Checkout uses: actions/checkout@v4 with: diff --git a/scripts/publish.sh b/scripts/publish.sh index 5e2856d..bd89c6f 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -104,6 +104,15 @@ build_asset() { local container_name="cdxs-build-${target_name}-${run_id}" echo "Building ${target_name} with Docker platform ${platform}" + + local proxy_build_args=() + local proxy_var + for proxy_var in HTTP_PROXY HTTPS_PROXY ALL_PROXY NO_PROXY http_proxy https_proxy all_proxy no_proxy; do + if [[ -n "${!proxy_var:-}" ]]; then + proxy_build_args+=(--build-arg "${proxy_var}=${!proxy_var}") + fi + done + docker buildx build \ --platform "${platform}" \ --target builder \ @@ -111,6 +120,7 @@ build_asset() { --build-arg "RUST_IMAGE=${rust_image}" \ --build-arg "CARGO_REGISTRY=${cargo_registry}" \ --build-arg "APT_MIRROR=${apt_mirror}" \ + "${proxy_build_args[@]}" \ --load \ -t "${image_tag}" \ -f scripts/docker/Dockerfile.release \