From 6bc7900b27dc2256978cd69661825b0214a48c4a Mon Sep 17 00:00:00 2001 From: CN-JS-HuiBai Date: Thu, 16 Apr 2026 20:25:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=9F=E6=88=90=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=BA=E5=A4=9A=E4=B8=AA=E5=8F=AF=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/autobuild.yml | 59 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/.gitea/workflows/autobuild.yml b/.gitea/workflows/autobuild.yml index 3029afaf..c50f65f0 100644 --- a/.gitea/workflows/autobuild.yml +++ b/.gitea/workflows/autobuild.yml @@ -24,10 +24,33 @@ jobs: runs-on: ubuntu-22.04 steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Checkout source + shell: bash + env: + CI_SERVER_URL: ${{ gitea.server_url }} + CI_REPOSITORY: ${{ gitea.repository }} + CI_REF: ${{ gitea.ref }} + CI_SHA: ${{ gitea.sha }} + CI_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + + workspace="${GITHUB_WORKSPACE:-$PWD}" + repo_url="${CI_SERVER_URL}/${CI_REPOSITORY}.git" + + rm -rf "$workspace/.git" + git init "$workspace" + git -C "$workspace" remote add origin "$repo_url" + + if [[ -n "${CI_TOKEN}" ]]; then + auth_header="Authorization: token ${CI_TOKEN}" + git -C "$workspace" -c http.extraHeader="$auth_header" fetch --depth=1 origin "${CI_REF}" + else + git -C "$workspace" fetch --depth=1 origin "${CI_REF}" + fi + + git -C "$workspace" checkout --detach FETCH_HEAD + git -C "$workspace" submodule update --init --recursive --depth=1 - name: Setup Go uses: actions/setup-go@v5 @@ -83,36 +106,14 @@ jobs: run: | set -euo pipefail chmod +x ./building-linux.sh - rm -rf dist artifacts - mkdir -p dist artifacts + rm -rf dist + mkdir -p dist VERSION="$VERSION" DIST_DIR="$PWD/dist" ./building-linux.sh ${BUILD_TARGETS} - - name: Package artifacts - shell: bash - run: | - set -euo pipefail - shopt -s nullglob - - for file in dist/*; do - name="$(basename "$file")" - if [[ "$name" == *.exe ]]; then - archive="artifacts/${name%.exe}-${VERSION}.zip" - zip -j "$archive" "$file" - else - archive="artifacts/${name}-${VERSION}.tar.gz" - tar -C dist -czf "$archive" "$name" - fi - done - - ( - cd artifacts - sha256sum * > SHA256SUMS.txt - ) - - name: Upload artifacts uses: actions/upload-artifact@v3 with: name: sing-box-${{ env.VERSION }} - path: artifacts + path: dist if-no-files-found: error