From be7112d08d640c0c74dfb418d567f9d58d57095b Mon Sep 17 00:00:00 2001 From: wanghu Date: Wed, 2 Sep 2026 11:31:00 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E7=A7=BB=E9=99=A4=20GitHub=20actions=20?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=EF=BC=8C=E5=86=85=E7=BD=91=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=20clone=20+=20=E7=B3=BB=E7=BB=9F=20dotnet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 内网无法访问 github.com,actions/checkout@v4 拉取失败导致 job 卡死。 改为与既有 build.yml 一致的手动 clone 本仓库方式,dotnet 用 runner 镜像预装。 --- .gitea/workflows/ci.yml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 18d6c0f..a8f7edf 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -8,12 +8,17 @@ jobs: build-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + # 内网无 GitHub,不能用 actions/checkout@v4;手动 clone 本仓库(Gitea Actions 已注入 GITHUB_TOKEN) + - name: 拉取源码(内网手动 clone) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git clone --depth 1 --branch "$GITHUB_REF_NAME" "http://x-access-token:${GITHUB_TOKEN}@gitea.yunhaixingtong.com/${{ github.repository }}.git" /tmp/src + cp -a /tmp/src/. . + rm -rf /tmp/src - - name: Setup .NET 8 - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x + - name: 确认 dotnet SDK + run: dotnet --version - name: Restore run: dotnet restore BasePlatformDotnet/yh-platform-net.sln @@ -33,12 +38,16 @@ jobs: needs: build-test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: 拉取源码(无内网 GitHub) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git clone --depth 1 --branch "$GITHUB_REF_NAME" "http://x-access-token:${GITHUB_TOKEN}@gitea.yunhaixingtong.com/${{ github.repository }}.git" /tmp/src + cp -a /tmp/src/. . + rm -rf /tmp/src - - name: Setup .NET 8 - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x + - name: 确认 dotnet SDK + run: dotnet --version - name: Pack run: dotnet pack BasePlatformDotnet/yh-platform-net.sln -c Release -o BasePlatformDotnet/artifacts @@ -63,4 +72,4 @@ jobs: EOF - dotnet nuget push "BasePlatformDotnet/artifacts/*.nupkg" --source nexus-nuget --configfile nuget-push.config --api-key nexus + dotnet nuget push "BasePlatformDotnet/artifacts/*.nupkg" --source nexus-nuget --configfile nuget-push.config --api-key nexus \ No newline at end of file