Skip to content

Commit 234e5ba

Browse files
committed
Add Nuget publishing workflow
1 parent 11d9c37 commit 234e5ba

File tree

2 files changed

+56
-4
lines changed

2 files changed

+56
-4
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
permissions:
99
contents: write
10+
id-token: write # Required for OIDC authentication to NuGet.org
1011

1112
jobs:
1213
build-release:
@@ -26,16 +27,32 @@ jobs:
2627
- name: Build
2728
run: dotnet build FunctionalStateMachine.sln --configuration Release --no-restore
2829

30+
- name: Test
31+
run: dotnet test FunctionalStateMachine.sln --configuration Release --no-build --verbosity normal
32+
2933
- name: Set Version
3034
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
3135

3236
- name: Pack
3337
run: |
34-
dotnet pack FunctionalStateMachine.Core/FunctionalStateMachine.Core.csproj --configuration Release --no-build --output ./artifacts --include-symbols --include-source /p:PackageVersion=${VERSION}
35-
dotnet pack FunctionalStateMachine.CommandRunner/FunctionalStateMachine.CommandRunner.csproj --configuration Release --no-build --output ./artifacts --include-symbols --include-source /p:PackageVersion=${VERSION}
36-
dotnet pack FunctionalStateMachine.Diagrams/FunctionalStateMachine.Diagrams.csproj --configuration Release --no-build --output ./artifacts --include-symbols --include-source /p:PackageVersion=${VERSION}
38+
dotnet pack src/FunctionalStateMachine.Core/FunctionalStateMachine.Core.csproj --configuration Release --no-build --output ./artifacts --include-symbols --include-source /p:PackageVersion=${VERSION}
39+
dotnet pack src/FunctionalStateMachine.CommandRunner/FunctionalStateMachine.CommandRunner.csproj --configuration Release --no-build --output ./artifacts --include-symbols --include-source /p:PackageVersion=${VERSION}
40+
dotnet pack src/FunctionalStateMachine.Diagrams/FunctionalStateMachine.Diagrams.csproj --configuration Release --no-build --output ./artifacts --include-symbols --include-source /p:PackageVersion=${VERSION}
41+
42+
- name: NuGet login (Trusted Publishing)
43+
uses: NuGet/login@v1
44+
id: nuget-login
45+
with:
46+
user: ${{ secrets.NUGET_USERNAME }} # Your NuGet.org username (not email)
47+
48+
- name: Push to NuGet.org
49+
run: |
50+
dotnet nuget push ./artifacts/*.nupkg \
51+
--api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} \
52+
--source https://api.nuget.org/v3/index.json \
53+
--skip-duplicate
3754
38-
- name: Release
55+
- name: Create GitHub Release
3956
uses: softprops/action-gh-release@v2
4057
with:
4158
files: |

Directory.Build.props

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
<Project>
22
<PropertyGroup>
3+
<!-- Version -->
34
<PackageVersion Condition="'$(PackageVersion)' == ''">0.0.0-dev</PackageVersion>
5+
6+
<!-- Package Metadata -->
7+
<Authors>Lee Oades</Authors>
8+
<Company>Lee Oades</Company>
9+
<Copyright>Copyright © $(Authors) $([System.DateTime]::Now.Year)</Copyright>
10+
<PackageProjectUrl>https://github.com/leeoades/FunctionalStateMachine</PackageProjectUrl>
11+
<RepositoryUrl>https://github.com/leeoades/FunctionalStateMachine</RepositoryUrl>
12+
<RepositoryType>git</RepositoryType>
13+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
14+
<PackageReadmeFile>README.md</PackageReadmeFile>
15+
<PackageTags>state-machine;functional;actor-model;fsm;dotnet</PackageTags>
16+
<PackageReleaseNotes>See CHANGELOG.md for release notes</PackageReleaseNotes>
17+
18+
<!-- Build Settings -->
19+
<LangVersion>latest</LangVersion>
20+
<Nullable>enable</Nullable>
21+
<ImplicitUsings>disable</ImplicitUsings>
22+
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
23+
24+
<!-- Source Link -->
25+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
26+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
27+
<IncludeSymbols>true</IncludeSymbols>
28+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
429
</PropertyGroup>
30+
31+
<!-- Include README in packages -->
32+
<ItemGroup>
33+
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="\" />
34+
</ItemGroup>
35+
36+
<!-- Source Link for debugging -->
37+
<ItemGroup>
38+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
39+
</ItemGroup>
540
</Project>

0 commit comments

Comments
 (0)