XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFEExtension.NetCore.XFEConsole

更新包引用,更新README文档,新增自动化发布流程

9c12752
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

6 个文件 +231 -15
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.XFEConsole`
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 +138 -0
@@ -0,0 +1,138 @@
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.XFEConsole.slnx
26 PROJECT_PATH: XFEExtension.NetCore.XFEConsole/XFEExtension.NetCore.XFEConsole.csproj
27 PACKAGE_OUTPUT_DIR: ${{ github.workspace }}/artifacts/packages
28
29 jobs:
30 publish:
31 runs-on: windows-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 shell: pwsh
80 run: |
81 $packages = Get-ChildItem -Path "${{ env.PACKAGE_OUTPUT_DIR }}" -Filter *.nupkg -File
82 if (-not $packages) {
83 throw "No .nupkg files found in ${{ env.PACKAGE_OUTPUT_DIR }}"
84 }
85
86 foreach ($package in $packages) {
87 dotnet nuget push $package.FullName --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key "${{ secrets.GITHUB_TOKEN }}" --skip-duplicate
88 }
89
90 - name: Publish to NuGet.org
91 if: ${{ github.event_name != 'workflow_dispatch' || !inputs.skip_nuget_org }}
92 shell: pwsh
93 run: |
94 $packages = Get-ChildItem -Path "${{ env.PACKAGE_OUTPUT_DIR }}" -Filter *.nupkg -File
95 if (-not $packages) {
96 throw "No .nupkg files found in ${{ env.PACKAGE_OUTPUT_DIR }}"
97 }
98
99 foreach ($package in $packages) {
100 dotnet nuget push $package.FullName --source "https://api.nuget.org/v3/index.json" --api-key "${{ secrets.NUGET_API_KEY }}" --skip-duplicate
101 }
102
103 - name: Create GitHub Release
104 if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
105 uses: softprops/action-gh-release@v2
106 with:
107 tag_name: ${{ github.ref_name }}
108 name: XFEExtension.NetCore.XFEConsole ${{ github.ref_name }}
109 generate_release_notes: true
110 append_body: true
111 body: |
112 ## Package feeds
113
114 - NuGet.org
115 - GitHub Packages: `https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json`
116 files: ${{ env.PACKAGE_OUTPUT_DIR }}/*.nupkg
117 fail_on_unmatched_files: true
118 prerelease: ${{ contains(env.PACKAGE_VERSION, '-') }}
119
120 - name: Publish summary
121 shell: bash
122 run: |
123 {
124 echo "## Published packages"
125 echo ""
126 echo "- Version: \`${PACKAGE_VERSION}\`"
127 echo "- GitHub Packages: published"
128 if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.skip_nuget_org }}" == "true" ]]; then
129 echo "- NuGet.org: skipped"
130 else
131 echo "- NuGet.org: published"
132 fi
133 if [[ "${{ github.event_name }}" == "push" && "${GITHUB_REF_NAME}" == v* ]]; then
134 echo "- GitHub Release: created"
135 else
136 echo "- GitHub Release: skipped"
137 fi
138 } >> "$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.XFEConsole.slnx
16 PROJECT_PATH: XFEExtension.NetCore.XFEConsole/XFEExtension.NetCore.XFEConsole.csproj
17
18 jobs:
19 build:
20 runs-on: windows-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 README.md +5 -5
@@ -1,11 +1,11 @@
1 1 # XFEExtension.NetCore.XFEConsole
2 2
3 [![NuGet Version](https://img.shields.io/nuget/v/XFEExtension.NetCore.XFEConsole.svg)](https://www.nuget.org/packages/XFEExtension.NetCore.XFEConsole/)
4 [![NuGet Downloads](https://img.shields.io/nuget/dt/XFEExtension.NetCore.XFEConsole.svg)](https://www.nuget.org/packages/XFEExtension.NetCore.XFEConsole/)
5 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6 [![.NET](https://img.shields.io/badge/.NET-10.0-blueviolet)](https://dotnet.microsoft.com/download)
3 [![NuGet](https://img.shields.io/nuget/v/XFEExtension.NetCore.XFEConsole?label=NuGet&logo=NuGet)](https://www.nuget.org/packages/XFEExtension.NetCore.XFEConsole/)
4 [![NuGet Downloads](https://img.shields.io/nuget/dt/XFEExtension.NetCore.XFEConsole?label=Downloads&logo=NuGet)](https://www.nuget.org/packages/XFEExtension.NetCore.XFEConsole/)
5 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE.txt)
6 [![.NET](https://img.shields.io/badge/.NET-10.0-512BD4)](https://dotnet.microsoft.com/download)
7 7
8 > 🌐 English | [中文](README_zh.md)
8 > 🌐 English | [简体中文](https://github.com/XFEstudio/XFEExtension.NetCore.XFEConsole/blob/master/README_zh.md)
9 9
10 10 ## Overview
11 11
Modified README_zh.md +5 -5
@@ -1,11 +1,11 @@
1 1 # XFEExtension.NetCore.XFEConsole
2 2
3 [![NuGet Version](https://img.shields.io/nuget/v/XFEExtension.NetCore.XFEConsole.svg)](https://www.nuget.org/packages/XFEExtension.NetCore.XFEConsole/)
4 [![NuGet Downloads](https://img.shields.io/nuget/dt/XFEExtension.NetCore.XFEConsole.svg)](https://www.nuget.org/packages/XFEExtension.NetCore.XFEConsole/)
5 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6 [![.NET](https://img.shields.io/badge/.NET-10.0-blueviolet)](https://dotnet.microsoft.com/download)
3 [![NuGet](https://img.shields.io/nuget/v/XFEExtension.NetCore.XFEConsole?label=NuGet&logo=NuGet)](https://www.nuget.org/packages/XFEExtension.NetCore.XFEConsole/)
4 [![NuGet Downloads](https://img.shields.io/nuget/dt/XFEExtension.NetCore.XFEConsole?label=Downloads&logo=NuGet)](https://www.nuget.org/packages/XFEExtension.NetCore.XFEConsole/)
5 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE.txt)
6 [![.NET](https://img.shields.io/badge/.NET-10.0-512BD4)](https://dotnet.microsoft.com/download)
7 7
8 > 🌐 [English](README.md) | 中文
8 > 🌐 [English](https://github.com/XFEstudio/XFEExtension.NetCore.XFEConsole/blob/master/README.md) | 中文
9 9
10 10 ## 简述
11 11
Modified XFEExtension.NetCore.XFEConsole/XFEExtension.NetCore.XFEConsole.csproj +3 -5
@@ -4,7 +4,7 @@
4 4 <TargetFramework>net10.0</TargetFramework>
5 5 <ImplicitUsings>enable</ImplicitUsings>
6 6 <Nullable>enable</Nullable>
7 <Version>2.2.1</Version>
7 <Version>2.2.2</Version>
8 8 <Authors>XFEstudio</Authors>
9 9 <Company>寰宇朽力网络科技</Company>
10 10 <Description>XFEConsole是一个可以运行用户进行远程输出的调试辅助工具,需要配合XFE工具箱来使用,当然也可以根据本DLL内的架构搭建一个调试工具</Description>
@@ -15,9 +15,7 @@
15 15 <RepositoryUrl>https://github.com/XFEstudio/XFEExtension.NetCore.XFEConsole.git</RepositoryUrl>
16 16 <PackageTags>XFE;Console;Test;Out;Output;Remote;</PackageTags>
17 17 <PackageReleaseNotes>
18 使 UseXFEConsoleLog 支持可选参数并升级版本号
19
20 将 UseXFEConsoleLog 的参数 xFEConsoleLogOptions 改为可选,未传入时自动使用默认配置,提升方法易用性;同时将项目版本号提升至 2.2.1。
18 更新包引用,更新README文档,新增自动化发布流程
21 19 </PackageReleaseNotes>
22 20 <PackageLicenseFile>LICENSE</PackageLicenseFile>
23 21 <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
@@ -46,7 +44,7 @@
46 44 </ItemGroup>
47 45
48 46 <ItemGroup>
49 <PackageReference Include="XFEExtension.NetCore" Version="4.0.*" />
47 <PackageReference Include="XFEExtension.NetCore" Version="4.2.*" />
50 48 </ItemGroup>
51 49
52 50 </Project>