返回提交历史
Modified
.github/workflows/publish-packages.yml
+7
-3
Modified
.github/workflows/validate.yml
+2
-6
XFEstudio/XFEExtension.NetCore.XUnit
优化 CI/CD 工作流触发条件与安全性
- 将 publish-packages.yml 触发条件改为 tag(v*)和手动触发,新增 version 输入参数 - 发布到 GitHub Packages 时改用 secrets.GH_PACKAGES_TOKEN 作为 API Key - 创建 Release 时 tag_name 和 name 使用 env.PACKAGE_VERSION,名称格式调整为 V${{ env.PACKAGE_VERSION }} - validate.yml 测试任务简化为仅在 windows-latest 上运行 - 上传测试报告时 artifact 名称由 reports-${{ matrix.os }} 改为 reports-${{ runner.os }}
4c6efc0
代码差异
2 个文件
+9
-9
@@ -2,6 +2,8 @@ name: Publish Packages
2
2
3
3
on:
4
4
push:
5
branches-ignore:
6
- "**"
5
7
tags:
6
8
- "v*"
7
9
workflow_dispatch:
@@ -80,6 +82,8 @@ jobs:
80
82
81
83
- name: Publish to GitHub Packages
82
84
shell: pwsh
85
env:
86
GH_PACKAGES_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
83
87
run: |
84
88
$packages = Get-ChildItem -Path "${{ env.PACKAGE_OUTPUT_DIR }}" -Filter *.nupkg -File
85
89
if (-not $packages) {
@@ -87,7 +91,7 @@ jobs:
87
91
}
88
92
89
93
foreach ($package in $packages) {
90
dotnet nuget push $package.FullName --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key "${{ secrets.GITHUB_TOKEN }}" --skip-duplicate
94
dotnet nuget push $package.FullName --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key "$env:GH_PACKAGES_TOKEN" --skip-duplicate
91
95
}
92
96
93
97
- name: Publish to NuGet.org
@@ -106,8 +110,8 @@ jobs:
106
110
- name: Create GitHub Release
107
111
uses: softprops/action-gh-release@v2
108
112
with:
109
tag_name: ${{ github.ref_name }}
110
name: XFEExtension.NetCore.XUnit ${{ github.ref_name }}
113
tag_name: ${{ env.PACKAGE_VERSION }}
114
name: V${{ env.PACKAGE_VERSION }}
111
115
generate_release_notes: true
112
116
append_body: true
113
117
body: |
@@ -17,11 +17,7 @@ env:
17
17
18
18
jobs:
19
19
test:
20
strategy:
21
fail-fast: false
22
matrix:
23
os: [windows-latest, ubuntu-latest, macos-latest]
24
runs-on: ${{ matrix.os }}
20
runs-on: windows-latest
25
21
26
22
steps:
27
23
- name: Checkout
@@ -49,6 +45,6 @@ jobs:
49
45
if: always()
50
46
uses: actions/upload-artifact@v4
51
47
with:
52
name: reports-${{ matrix.os }}
48
name: reports-${{ runner.os }}
53
49
path: ${{ runner.temp }}/xfe-*-artifacts
54
50
if-no-files-found: warn