XFEExtension.NetCore.ServerInteractive
[DLL] Server interaction extension, including user identity verification and querying in conjunction with AutoConfig
关注
0
Fork
0
Star
0
返回提交历史
Added
.github/PUBLISHING.md
+31
-0
Added
.github/workflows/publish-packages.yml
+98
-0
Added
.github/workflows/validate.yml
+34
-0
XFEstudio/XFEExtension.NetCore.ServerInteractive
Add GitHub Actions package publishing workflows
e6fafa3
代码差异
3 个文件
+163
-0
@@ -0,0 +1,31 @@
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.ServerInteractive`
13
14
No extra secret is required for GitHub Packages. The workflow uses the built-in `GITHUB_TOKEN` and requests `packages: write`.
15
16
## Recommended release flow
17
18
1. Update the project and verify CI is green.
19
2. Push a version tag such as `v3.0.9`.
20
3. GitHub Actions will build, pack, upload the generated `.nupkg` as an artifact, then publish it to:
21
- NuGet.org
22
- GitHub Packages at `https://nuget.pkg.github.com/XFEstudio/index.json`
23
24
## Manual publish
25
26
If you need to republish with a specific version from the GitHub Actions UI:
27
28
1. Open `Publish Packages`.
29
2. Click `Run workflow`.
30
3. Fill in the `version` input.
31
4. Optionally set `skip_nuget_org` to `true` when you only want GitHub Packages.
@@ -0,0 +1,98 @@
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: read
21
packages: write
22
23
env:
24
DOTNET_VERSION: 10.0.x
25
SOLUTION_PATH: XFEExtension.NetCore.ServerInteractive.slnx
26
PROJECT_PATH: XFEExtension.NetCore.ServerInteractive/XFEExtension.NetCore.ServerInteractive.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.SOLUTION_PATH }}
64
65
- name: Build
66
run: dotnet build ${{ env.SOLUTION_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: Publish summary
86
shell: bash
87
run: |
88
{
89
echo "## Published packages"
90
echo ""
91
echo "- Version: \`${PACKAGE_VERSION}\`"
92
echo "- GitHub Packages: published"
93
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.skip_nuget_org }}" == "true" ]]; then
94
echo "- NuGet.org: skipped"
95
else
96
echo "- NuGet.org: published"
97
fi
98
} >> "$GITHUB_STEP_SUMMARY"
@@ -0,0 +1,34 @@
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.ServerInteractive.slnx
16
17
jobs:
18
build:
19
runs-on: ubuntu-latest
20
21
steps:
22
- name: Checkout
23
uses: actions/checkout@v4
24
25
- name: Setup .NET
26
uses: actions/setup-dotnet@v4
27
with:
28
dotnet-version: ${{ env.DOTNET_VERSION }}
29
30
- name: Restore
31
run: dotnet restore ${{ env.SOLUTION_PATH }}
32
33
- name: Build
34
run: dotnet build ${{ env.SOLUTION_PATH }} --configuration Release --no-restore -p:GeneratePackageOnBuild=false -p:ContinuousIntegrationBuild=true