ci: workflow 移到仓库根 .gitea/workflows,路径适配 BasePlatformDotnet 子目录
Gitea Actions 仅识别仓库根 .gitea/workflows/,原 BasePlatformDotnet/.gitea/workflows/ci.yml 不触发。 - 移动到根 .gitea/workflows/ci.yml - 所有 dotnet 命令改指 BasePlatformDotnet/yh-platform-net.sln - 推送目标 artifacts 同步 BasePlatformDotnet/artifacts
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
name: ci
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup .NET 8
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore yh-platform-net.sln
|
||||
|
||||
- name: Build
|
||||
run: dotnet build yh-platform-net.sln --no-restore -c Release
|
||||
|
||||
- name: Test
|
||||
run: dotnet test yh-platform-net.sln --no-build -c Release --logger "console;verbosity=normal"
|
||||
|
||||
- name: Pack
|
||||
run: dotnet pack yh-platform-net.sln --no-build -c Release -o artifacts
|
||||
|
||||
publish:
|
||||
# 仅主分支 push 时发版到 Nexus 私服(PR 不触发)
|
||||
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
|
||||
needs: build-test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup .NET 8
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
|
||||
- name: Pack
|
||||
run: dotnet pack yh-platform-net.sln -c Release -o artifacts
|
||||
|
||||
- name: Push to Nexus
|
||||
# Nexus 的 NuGet 推送认证走 HTTP Basic(账号+密码),不校验 api-key;
|
||||
# 且 Nexus 为 http 源,SDK 8 需在 nuget.config 显式 allowInsecureConnections=true。
|
||||
# 动态生成带凭据的 nuget.config 并指定 --configfile,避免凭据入 git。
|
||||
run: |
|
||||
cat > nuget-push.config <<EOF
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="nexus-nuget" value="${{ secrets.NEXUS_URL }}" allowInsecureConnections="true" />
|
||||
</packageSources>
|
||||
<packageSourceCredentials>
|
||||
<nexus-nuget>
|
||||
<add key="Username" value="${{ secrets.NEXUS_USER }}" />
|
||||
<add key="ClearTextPassword" value="${{ secrets.NEXUS_PASS }}" />
|
||||
</nexus-nuget>
|
||||
</packageSourceCredentials>
|
||||
</configuration>
|
||||
EOF
|
||||
dotnet nuget push "artifacts/*.nupkg" --source nexus-nuget --configfile nuget-push.config --api-key nexus
|
||||
Reference in New Issue
Block a user