ci: 移除 GitHub actions 依赖,内网手动 clone + 系统 dotnet
内网无法访问 github.com,actions/checkout@v4 拉取失败导致 job 卡死。 改为与既有 build.yml 一致的手动 clone 本仓库方式,dotnet 用 runner 镜像预装。
This commit is contained in:
+20
-11
@@ -8,12 +8,17 @@ jobs:
|
|||||||
build-test:
|
build-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
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
|
- name: 确认 dotnet SDK
|
||||||
uses: actions/setup-dotnet@v4
|
run: dotnet --version
|
||||||
with:
|
|
||||||
dotnet-version: 8.0.x
|
|
||||||
|
|
||||||
- name: Restore
|
- name: Restore
|
||||||
run: dotnet restore BasePlatformDotnet/yh-platform-net.sln
|
run: dotnet restore BasePlatformDotnet/yh-platform-net.sln
|
||||||
@@ -33,12 +38,16 @@ jobs:
|
|||||||
needs: build-test
|
needs: build-test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
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
|
- name: 确认 dotnet SDK
|
||||||
uses: actions/setup-dotnet@v4
|
run: dotnet --version
|
||||||
with:
|
|
||||||
dotnet-version: 8.0.x
|
|
||||||
|
|
||||||
- name: Pack
|
- name: Pack
|
||||||
run: dotnet pack BasePlatformDotnet/yh-platform-net.sln -c Release -o BasePlatformDotnet/artifacts
|
run: dotnet pack BasePlatformDotnet/yh-platform-net.sln -c Release -o BasePlatformDotnet/artifacts
|
||||||
@@ -63,4 +72,4 @@ jobs:
|
|||||||
</packageSourceCredentials>
|
</packageSourceCredentials>
|
||||||
</configuration>
|
</configuration>
|
||||||
EOF
|
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
|
||||||
Reference in New Issue
Block a user