XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension.NetCore.WinUIHelper

【DLL】WinUI的各种工具类,帮助开发者快速构建一个模块化的WinUI项目

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFEExtension.NetCore.WinUIHelper

升级至 .NET 10.0 并引入自动化发布流程

本次提交将项目全面升级到 .NET 10.0,并同步更新主要依赖包至最新版本。提升主项目版本号至 2.0.0-preview.1.1。新增 CI/CD 自动化脚本(validate.yml、publish-packages.yml)及 PUBLISHING.md,支持自动化构建、打包、发布和 Release 管理,完善发布流程文档说明。

780b947
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

5 个文件 +211 -13
Added .github/PUBLISHING.md +45 -0
@@ -0,0 +1,45 @@
1 # Publishing Packages
2
3 This repository now includes two GitHub Actions workflows:
4
5 - `Validate`: runs on `push` and `pull_request` to ensure the solution restores and builds cleanly.
6 - `Publish Packages`: runs when you push a tag that starts with `v`, for example `v3.0.9`, or when you trigger it manually from the Actions page.
7
8 ## Required secrets
9
10 Add this repository secret before publishing to NuGet.org:
11
12 - `NUGET_API_KEY`: API key from NuGet.org with push permission for `XFEExtension.NetCore.WinUIHelper`
13
14 No extra secret is required for GitHub Packages. The workflow uses the built-in `GITHUB_TOKEN` and requests `packages: write`.
15
16 The same built-in `GITHUB_TOKEN` is also used to create the GitHub Release and upload package assets.
17
18 ## Recommended release flow
19
20 1. Update the project and verify CI is green.
21 2. Push a version tag such as `v3.0.9`.
22 3. GitHub Actions will automatically do all of the following:
23 - build and pack the project
24 - upload the generated `.nupkg` as a workflow artifact
25 - publish the package to NuGet.org
26 - publish the package to GitHub Packages at `https://nuget.pkg.github.com/XFEstudio/index.json`
27 - create a GitHub Release for that tag
28 - attach the generated `.nupkg` files to the GitHub Release
29
30 ## Tag-triggered release behavior
31
32 When you push a new tag like `v3.0.9`, that single action is the release trigger for the entire pipeline. You do not need to manually start the workflow afterward.
33
34 The release workflow is tied to `push.tags: v*`, so each new version tag automatically runs the full publishing flow.
35
36 ## Manual publish
37
38 If you need to republish packages from the GitHub Actions UI:
39
40 1. Open `Publish Packages`.
41 2. Click `Run workflow`.
42 3. Fill in the `version` input.
43 4. Optionally set `skip_nuget_org` to `true` when you only want GitHub Packages.
44
45 Manual runs publish packages, but GitHub Release creation is only performed for real tag pushes so the release stays aligned with the repository tag history.
Added .github/workflows/publish-packages.yml +120 -0
@@ -0,0 +1,120 @@
1 name: Publish Packages
2
3 on:
4 push:
5 tags:
6 - "v*"
7 workflow_dispatch:
8 inputs:
9 version:
10 description: Package version to publish, for example 3.0.9
11 required: true
12 type: string
13 skip_nuget_org:
14 description: Skip publishing to NuGet.org
15 required: false
16 default: false
17 type: boolean
18
19 permissions:
20 contents: write
21 packages: write
22
23 env:
24 DOTNET_VERSION: 10.0.x
25 SOLUTION_PATH: XFEExtension.NetCore.WinUIHelper.slnx
26 PROJECT_PATH: XFEExtension.NetCore.WinUIHelper/XFEExtension.NetCore.WinUIHelper.csproj
27 PACKAGE_OUTPUT_DIR: ${{ github.workspace }}/artifacts/packages
28
29 jobs:
30 publish:
31 runs-on: ubuntu-latest
32
33 steps:
34 - name: Checkout
35 uses: actions/checkout@v4
36 with:
37 fetch-depth: 0
38
39 - name: Setup .NET
40 uses: actions/setup-dotnet@v4
41 with:
42 dotnet-version: ${{ env.DOTNET_VERSION }}
43
44 - name: Resolve version
45 id: version
46 shell: bash
47 run: |
48 if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
49 version="${{ inputs.version }}"
50 else
51 version="${GITHUB_REF_NAME#v}"
52 fi
53
54 if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?([-.][0-9A-Za-z.-]+)?$ ]]; then
55 echo "Invalid package version: $version"
56 exit 1
57 fi
58
59 echo "value=$version" >> "$GITHUB_OUTPUT"
60 echo "PACKAGE_VERSION=$version" >> "$GITHUB_ENV"
61
62 - name: Restore
63 run: dotnet restore ${{ env.PROJECT_PATH }}
64
65 - name: Build
66 run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore -p:GeneratePackageOnBuild=false -p:ContinuousIntegrationBuild=true -p:Version=${{ env.PACKAGE_VERSION }} -p:PackageVersion=${{ env.PACKAGE_VERSION }}
67
68 - name: Pack
69 run: dotnet pack ${{ env.PROJECT_PATH }} --configuration Release --no-build --no-restore --output ${{ env.PACKAGE_OUTPUT_DIR }} -p:GeneratePackageOnBuild=false -p:ContinuousIntegrationBuild=true -p:Version=${{ env.PACKAGE_VERSION }} -p:PackageVersion=${{ env.PACKAGE_VERSION }}
70
71 - name: Upload package artifacts
72 uses: actions/upload-artifact@v4
73 with:
74 name: packages-${{ env.PACKAGE_VERSION }}
75 path: ${{ env.PACKAGE_OUTPUT_DIR }}/*.nupkg
76 if-no-files-found: error
77
78 - name: Publish to GitHub Packages
79 run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIR }}/*.nupkg --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key "${{ secrets.GITHUB_TOKEN }}" --skip-duplicate
80
81 - name: Publish to NuGet.org
82 if: ${{ github.event_name != 'workflow_dispatch' || !inputs.skip_nuget_org }}
83 run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIR }}/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key "${{ secrets.NUGET_API_KEY }}" --skip-duplicate
84
85 - name: Create GitHub Release
86 if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
87 uses: softprops/action-gh-release@v2
88 with:
89 tag_name: ${{ github.ref_name }}
90 name: XFEExtension.NetCore.WinUIHelper ${{ github.ref_name }}
91 generate_release_notes: true
92 append_body: true
93 body: |
94 ## Package feeds
95
96 - NuGet.org
97 - GitHub Packages: `https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json`
98 files: ${{ env.PACKAGE_OUTPUT_DIR }}/*.nupkg
99 fail_on_unmatched_files: true
100 prerelease: ${{ contains(env.PACKAGE_VERSION, '-') }}
101
102 - name: Publish summary
103 shell: bash
104 run: |
105 {
106 echo "## Published packages"
107 echo ""
108 echo "- Version: \`${PACKAGE_VERSION}\`"
109 echo "- GitHub Packages: published"
110 if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.skip_nuget_org }}" == "true" ]]; then
111 echo "- NuGet.org: skipped"
112 else
113 echo "- NuGet.org: published"
114 fi
115 if [[ "${{ github.event_name }}" == "push" && "${GITHUB_REF_NAME}" == v* ]]; then
116 echo "- GitHub Release: created"
117 else
118 echo "- GitHub Release: skipped"
119 fi
120 } >> "$GITHUB_STEP_SUMMARY"
Added .github/workflows/validate.yml +35 -0
@@ -0,0 +1,35 @@
1 name: Validate
2
3 on:
4 push:
5 branches:
6 - master
7 - main
8 pull_request:
9
10 permissions:
11 contents: read
12
13 env:
14 DOTNET_VERSION: 10.0.x
15 SOLUTION_PATH: XFEExtension.NetCore.WinUIHelper.slnx
16 PROJECT_PATH: XFEExtension.NetCore.WinUIHelper/XFEExtension.NetCore.WinUIHelper.csproj
17
18 jobs:
19 build:
20 runs-on: ubuntu-latest
21
22 steps:
23 - name: Checkout
24 uses: actions/checkout@v4
25
26 - name: Setup .NET
27 uses: actions/setup-dotnet@v4
28 with:
29 dotnet-version: ${{ env.DOTNET_VERSION }}
30
31 - name: Restore
32 run: dotnet restore ${{ env.PROJECT_PATH }}
33
34 - name: Build
35 run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore -p:GeneratePackageOnBuild=false -p:ContinuousIntegrationBuild=true
Modified XFEExtension.NetCore.WinUIHelper.TestApp/XFEExtension.NetCore.WinUIHelper.TestApp.csproj +5 -5
@@ -1,7 +1,7 @@
1 1 <Project Sdk="Microsoft.NET.Sdk">
2 2 <PropertyGroup>
3 3 <OutputType>WinExe</OutputType>
4 <TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
4 <TargetFramework>net10.0-windows10.0.22621.0</TargetFramework>
5 5 <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
6 6 <RootNamespace>XFEExtension.NetCore.WinUIHelper.TestApp</RootNamespace>
7 7 <ApplicationManifest>app.manifest</ApplicationManifest>
@@ -53,10 +53,10 @@
53 53 <ProjectCapability Include="Msix" />
54 54 </ItemGroup>
55 55 <ItemGroup>
56 <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
57 <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250401001" />
58 <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
59 <PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.2.250402" />
56 <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.28000.1839" />
57 <PackageReference Include="Microsoft.WindowsAppSDK" Version="2.0.1" />
58 <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
59 <PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.2.251219" />
60 60 <PackageReference Include="XFEExtension.NetCore.AutoConfig" Version="2.0.*" />
61 61 </ItemGroup>
62 62 <ItemGroup>
Modified XFEExtension.NetCore.WinUIHelper/XFEExtension.NetCore.WinUIHelper.csproj +6 -8
@@ -1,6 +1,6 @@
1 1 <Project Sdk="Microsoft.NET.Sdk">
2 2 <PropertyGroup>
3 <TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
3 <TargetFramework>net10.0-windows10.0.19041.0</TargetFramework>
4 4 <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
5 5 <RootNamespace>XFEExtension.NetCore.WinUIHelper</RootNamespace>
6 6 <RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
@@ -9,7 +9,7 @@
9 9 <Nullable>enable</Nullable>
10 10 <GenerateDocumentationFile>True</GenerateDocumentationFile>
11 11 <Title>XFEExtension.NetCore.WinUIHelper</Title>
12 <Version>1.2.5</Version>
12 <Version>2.0.0</Version>
13 13 <Authors>XFEstudio</Authors>
14 14 <PackageIcon>logoIcon.png</PackageIcon>
15 15 <Description>WinUI的各种工具类,帮助开发者快速构建一个模块化的WinUI项目</Description>
@@ -17,9 +17,7 @@
17 17 <NeutralLanguage>zh-CN</NeutralLanguage>
18 18 <PackageReadmeFile>README.md</PackageReadmeFile>
19 19 <PackageReleaseNotes>
20 命名空间重命名及版本号升级至1.2.5
21
22 将 Utilities.Addition 重命名为 Utilities.Additions,并同步更新相关引用。项目版本号由 1.2.4 升级为 1.2.5。
20 目前已正式升级至.NET 10.0
23 21 </PackageReleaseNotes>
24 22 <PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
25 23 <PackageProjectUrl>https://github.com/XFEstudio/XFEExtension.NetCore.WinUIHelper</PackageProjectUrl>
@@ -43,9 +41,9 @@
43 41 </None>
44 42 </ItemGroup>
45 43 <ItemGroup>
46 <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
47 <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250310001" />
48 <PackageReference Include="XFEExtension.NetCore" Version="3.3.*" />
44 <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.28000.1839" />
45 <PackageReference Include="Microsoft.WindowsAppSDK" Version="2.0.1" />
46 <PackageReference Include="XFEExtension.NetCore" Version="4.2.3" />
49 47 <PackageReference Include="XFEExtension.NetCore.AutoPath" Version="1.0.1" />
50 48 <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.*" />
51 49 </ItemGroup>