Skip to content

Commit 609d2f7

Browse files
authored
Add dotnet tool support (#212)
1 parent 916a681 commit 609d2f7

3 files changed

Lines changed: 118 additions & 0 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: NuGet Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
workflow_dispatch:
8+
inputs:
9+
tag_name:
10+
description: "Release tag name (e.g., '1.0.1')"
11+
required: true
12+
type: string
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: false
17+
18+
permissions:
19+
contents: read
20+
21+
env:
22+
VERSION_NUMBER: ${{ github.event.inputs.tag_name || github.event.release.tag_name }}
23+
DOTNET_VERSION: "10.0.x"
24+
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
25+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1"
26+
DOTNET_NOLOGO: "true"
27+
PROJECT_PATH: ./src/AzureEventGridSimulator/AzureEventGridSimulator.csproj
28+
CONFIGURATION: Release
29+
30+
jobs:
31+
publish-nuget:
32+
name: Publish to NuGet
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v4
38+
39+
- name: Setup .NET
40+
uses: actions/setup-dotnet@v4
41+
with:
42+
dotnet-version: ${{ env.DOTNET_VERSION }}
43+
44+
- name: Restore dependencies
45+
run: dotnet restore ${{ env.PROJECT_PATH }}
46+
47+
- name: Build
48+
run: >-
49+
dotnet build ${{ env.PROJECT_PATH }}
50+
--configuration ${{ env.CONFIGURATION }}
51+
--no-restore
52+
53+
- name: Pack
54+
run: >-
55+
dotnet pack ${{ env.PROJECT_PATH }}
56+
--configuration ${{ env.CONFIGURATION }}
57+
--no-build
58+
/p:Version=${{ env.VERSION_NUMBER }}
59+
--output ./nupkg
60+
61+
- name: Push to NuGet
62+
run: >-
63+
dotnet nuget push ./nupkg/*.nupkg
64+
--api-key ${{ secrets.NUGET_API_KEY }}
65+
--source https://api.nuget.org/v3/index.json
66+
--skip-duplicate

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,40 @@
55
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/pmcilreavy/AzureEventGridSimulator?label=latest)
66
![GitHub all releases](https://img.shields.io/github/downloads/pmcilreavy/AzureEventGridSimulator/total)
77
![Docker Pulls](https://img.shields.io/docker/pulls/pmcilreavy/azureeventgridsimulator)
8+
![NuGet Version](https://img.shields.io/nuget/v/AzureEventGridSimulator)
89

910
A simulator that provides endpoints to mimic the functionality of [Azure Event Grid](https://azure.microsoft.com/en-au/services/event-grid/) topics and subscribers and is compatible with the `Microsoft.Azure.EventGrid` client library. Both the `EventGrid` schema and the `CloudEvents v1.0` schema are supported.
1011

12+
## Installation
13+
14+
### .NET Tool (Recommended)
15+
16+
Install as a global .NET tool:
17+
18+
```bash
19+
dotnet tool install -g AzureEventGridSimulator
20+
```
21+
22+
Then run with:
23+
24+
```bash
25+
azure-eventgrid-simulator
26+
```
27+
28+
To update to the latest version:
29+
30+
```bash
31+
dotnet tool update -g AzureEventGridSimulator
32+
```
33+
34+
### Docker
35+
36+
See the [Docker](#docker) section below for running via Docker.
37+
38+
### Binary Release
39+
40+
Download standalone executables from [GitHub Releases](https://github.com/pmcilreavy/AzureEventGridSimulator/releases).
41+
1142
## Configuration
1243

1344
Topics and their subscribers are configured in the `appsettings.json` file.

src/AzureEventGridSimulator/AzureEventGridSimulator.csproj

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
33
<IsWebConfigTransformDisabled>true</IsWebConfigTransformDisabled>
4+
5+
<!-- .NET Tool packaging -->
6+
<IsPackable>true</IsPackable>
7+
<PackAsTool>true</PackAsTool>
8+
<ToolCommandName>azure-eventgrid-simulator</ToolCommandName>
9+
<PackageId>AzureEventGridSimulator</PackageId>
10+
<PackageOutputPath>./nupkg</PackageOutputPath>
11+
12+
<!-- NuGet metadata -->
13+
<Authors>Paul McIlreavy</Authors>
14+
<Description>A simulator that provides endpoints to mimic the functionality of Azure Event Grid topics and subscribers. Compatible with the Microsoft.Azure.EventGrid client library. Supports both EventGrid and CloudEvents v1.0 schemas.</Description>
15+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
16+
<PackageProjectUrl>https://github.com/pmcilreavy/AzureEventGridSimulator</PackageProjectUrl>
17+
<RepositoryUrl>https://github.com/pmcilreavy/AzureEventGridSimulator</RepositoryUrl>
18+
<RepositoryType>git</RepositoryType>
19+
<PackageTags>azure;eventgrid;event-grid;simulator;emulator;development;testing</PackageTags>
20+
<PackageReadmeFile>README.md</PackageReadmeFile>
421
</PropertyGroup>
522

23+
<ItemGroup>
24+
<None Include="../../README.md" Pack="true" PackagePath="/" />
25+
</ItemGroup>
26+
627
<ItemGroup>
728
<PackageReference Include="Asp.Versioning.Mvc" />
829
<PackageReference Include="Serilog.AspNetCore" />

0 commit comments

Comments
 (0)