From 755e6627c394421d3f2238cff06c26d65ce1ba3c Mon Sep 17 00:00:00 2001 From: juewuy Date: Mon, 8 Dec 2025 13:38:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E4=BF=AE=E6=94=B9=20=20=20=20=20=20?= =?UTF-8?q?=20=20.github/workflows/test.yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yaml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 827ebcb..f29d206 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -95,10 +95,24 @@ jobs: fetch-depth: 1 - name: Setup Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: go-version: ${{needs.go.outputs.version}} - + - name: Set variables + run: | + VERSION="${GITHUB_REF_NAME,,}-$(git rev-parse --short HEAD)" + VERSION="${VERSION//\//-}" + PackageVersion="$(curl -s "https://api.github.com/repos/MetaCubeX/mihomo/releases/latest" | jq -r '.tag_name' | sed 's/v//g' | awk -F '.' '{$NF = $NF + 1; print}' OFS='.').${VERSION/-/.}" + if [ -n "${{ github.event.inputs.version }}" ]; then + VERSION=${{ github.event.inputs.version }} + PackageVersion="${VERSION#v}" + fi + echo "VERSION=${VERSION}" >> $GITHUB_ENV + echo "PackageVersion=${PackageVersion}" >> $GITHUB_ENV + echo "BUILDTIME=$(date)" >> $GITHUB_ENV + echo "CGO_ENABLED=0" >> $GITHUB_ENV + echo "BUILDTAG=-extldflags --static" >> $GITHUB_ENV + echo "GOTOOLCHAIN=local" >> $GITHUB_ENV - name: Set ENV run: | sudo timedatectl set-timezone "Asia/Shanghai" @@ -114,8 +128,9 @@ jobs: - name: build core id: build - run: go build -v -trimpath -ldflags "-X 'github.com/metacubex/mihomo/constant.Version=${VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -s -w -buildid=" -tags "${TAGS}" -o meta - + run: | + go env + go build -v -tags "with_gvisor" -trimpath -ldflags "${BUILDTAG} -X 'github.com/metacubex/mihomo/constant.Version=${VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -w -s -buildid=" - name: Upload file to workspace uses: actions/upload-artifact@v4 with: