Skip to content

Commit 3120936

Browse files
Rafal Maciagclaude
andcommitted
Add NuGet packaging configuration for ModelingEvolution.XTermBlazor
- Set PackageId to ModelingEvolution.XTermBlazor - Add GitHub Actions workflow for NuGet publishing - Add CI workflow for build validation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5ac2d69 commit 3120936

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master, develop ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
dotnet-version: ['6.0.x', '7.0.x', '8.0.x', '9.0.x']
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup .NET ${{ matrix.dotnet-version }}
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: ${{ matrix.dotnet-version }}
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '18'
29+
30+
- name: Restore dependencies
31+
run: dotnet restore
32+
33+
- name: Build
34+
run: dotnet build --configuration Release --no-restore
35+
36+
- name: Test
37+
run: dotnet test --no-build --verbosity normal --configuration Release
38+
39+
- name: Pack (dry run)
40+
run: dotnet pack XtermBlazor/XtermBlazor.csproj --configuration Release --no-build --output ./nupkgs

.github/workflows/publish-nuget.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Publish NuGet Package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to publish (e.g., 2.1.3)'
11+
required: false
12+
type: string
13+
14+
jobs:
15+
publish:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup .NET
22+
uses: actions/setup-dotnet@v4
23+
with:
24+
dotnet-version: |
25+
6.0.x
26+
7.0.x
27+
8.0.x
28+
9.0.x
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: '18'
34+
35+
- name: Extract version from tag
36+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
37+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
38+
39+
- name: Use provided version
40+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != ''
41+
run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
42+
43+
- name: Update version in csproj
44+
if: env.VERSION != ''
45+
run: |
46+
sed -i "s/<Version>.*<\/Version>/<Version>${VERSION}<\/Version>/" XtermBlazor/XtermBlazor.csproj
47+
48+
- name: Restore dependencies
49+
run: dotnet restore
50+
51+
- name: Build
52+
run: dotnet build --configuration Release --no-restore
53+
54+
- name: Pack
55+
run: dotnet pack XtermBlazor/XtermBlazor.csproj --configuration Release --no-build --output ./nupkgs
56+
57+
- name: Push to NuGet.org
58+
run: dotnet nuget push ./nupkgs/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
59+
60+
- name: Push to GitHub Packages
61+
run: |
62+
dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/modelingevolution/index.json"
63+
dotnet nuget push ./nupkgs/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate

XtermBlazor/XtermBlazor.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
to get incremental builds to work correctly (albeit not as fast as if FastUpToDateCheck did work
1414
for them) -->
1515
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
16+
<PackageId>ModelingEvolution.XTermBlazor</PackageId>
1617
<Authors>BattlefieldDuck</Authors>
1718
<RepositoryUrl>https://github.com/BattlefieldDuck/XtermBlazor</RepositoryUrl>
1819
<PackageProjectUrl>https://github.com/BattlefieldDuck/XtermBlazor</PackageProjectUrl>

0 commit comments

Comments
 (0)