Skip to content

Commit 613115f

Browse files
kyurkchyanclaude
andauthored
Add CI/CD pipelines for automated NuGet releases
* Added CI/CD pipelines * Fixed alpha * Update gitignore * Use feature branch * Handle missing NUGET_API_KEY gracefully in CI/CD - Alpha releases: warn and skip NuGet push if secret not set - Stable releases: fail with clear error if secret missing - Use environment variable for safer secret handling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b79f2ae commit 613115f

6 files changed

Lines changed: 543 additions & 13 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Alpha Release
2+
3+
on:
4+
push:
5+
branches: [master, 'feature/GK/cicd-pipelines']
6+
paths-ignore:
7+
- '**.md'
8+
- 'docs/**'
9+
workflow_dispatch:
10+
inputs:
11+
base_version:
12+
description: 'Base version (without alpha suffix)'
13+
required: false
14+
default: '1.0.0'
15+
16+
env:
17+
BASE_VERSION: '1.0.0'
18+
19+
jobs:
20+
alpha-release:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup .NET
28+
uses: actions/setup-dotnet@v4
29+
with:
30+
dotnet-version: '10.0.x'
31+
32+
- name: Generate version
33+
id: version
34+
run: |
35+
# Use input version if provided (workflow_dispatch), otherwise use env default
36+
BASE="${{ github.event.inputs.base_version || env.BASE_VERSION }}"
37+
ALPHA_VERSION="${BASE}-alpha.${GITHUB_RUN_NUMBER}"
38+
echo "version=$ALPHA_VERSION" >> $GITHUB_OUTPUT
39+
echo "Generated version: $ALPHA_VERSION"
40+
41+
- name: Restore dependencies
42+
run: dotnet restore ServiceBusToolset
43+
44+
- name: Build
45+
run: dotnet build ServiceBusToolset -c Release --no-restore
46+
47+
- name: Pack
48+
run: dotnet pack ServiceBusToolset -c Release --no-build -o ./artifacts -p:Version=${{ steps.version.outputs.version }}
49+
50+
- name: Push to NuGet
51+
env:
52+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
53+
run: |
54+
if [ -z "$NUGET_API_KEY" ]; then
55+
echo "::warning::NUGET_API_KEY secret not set, skipping publish"
56+
exit 0
57+
fi
58+
dotnet nuget push ./artifacts/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Stable Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
stable-release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: '10.0.x'
20+
21+
- name: Extract version from tag
22+
id: version
23+
run: |
24+
VERSION=${GITHUB_REF_NAME#v}
25+
echo "version=$VERSION" >> $GITHUB_OUTPUT
26+
echo "Releasing version: $VERSION"
27+
28+
- name: Restore dependencies
29+
run: dotnet restore ServiceBusToolset
30+
31+
- name: Build
32+
run: dotnet build ServiceBusToolset -c Release --no-restore
33+
34+
- name: Pack
35+
run: dotnet pack ServiceBusToolset -c Release --no-build -o ./artifacts -p:Version=${{ steps.version.outputs.version }}
36+
37+
- name: Push to NuGet
38+
env:
39+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
40+
run: |
41+
if [ -z "$NUGET_API_KEY" ]; then
42+
echo "::error::NUGET_API_KEY secret is required for stable releases"
43+
exit 1
44+
fi
45+
dotnet nuget push ./artifacts/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
46+
47+
- name: Upload package to GitHub Release
48+
uses: softprops/action-gh-release@v2
49+
with:
50+
files: |
51+
./artifacts/*.nupkg
52+
./artifacts/*.snupkg

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*.user
1010
*.userosscache
1111
*.sln.docstates
12+
settings.local.json
1213

1314
#Claude
1415
**/.fuse*

README.md

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,34 @@
22

33
A command-line tool for managing Azure Service Bus.
44

5-
## Prerequisites
5+
## Installation
66

7-
- .NET 10 SDK or later
8-
- Azure CLI logged in (`az login`)
7+
### Global Tool (Recommended)
98

10-
## Installation
9+
```bash
10+
# Install from NuGet
11+
dotnet tool install -g ServiceBusToolset
12+
13+
# Update to latest version
14+
dotnet tool update -g ServiceBusToolset
15+
16+
# Install preview/alpha version
17+
dotnet tool install -g ServiceBusToolset --prerelease
18+
```
19+
20+
### Build from Source
1121

1222
```bash
23+
git clone https://github.com/kyurkchyan/ServiceBusToolset.git
24+
cd ServiceBusToolset
1325
dotnet build
1426
```
1527

28+
## Prerequisites
29+
30+
- .NET 10 SDK or later
31+
- Azure CLI logged in (`az login`)
32+
1633
## Commands
1734

1835
| Command | Description |
@@ -27,34 +44,36 @@ dotnet build
2744

2845
```bash
2946
# Purge all DLQ messages from a queue
30-
dotnet run -- purge-dlq -n mynamespace.servicebus.windows.net -q myqueue
47+
sbtools purge-dlq -n mynamespace.servicebus.windows.net -q myqueue
3148

3249
# Interactive mode - select which message categories to purge
33-
dotnet run -- purge-dlq -n mynamespace.servicebus.windows.net -q myqueue -i
50+
sbtools purge-dlq -n mynamespace.servicebus.windows.net -q myqueue -i
3451

3552
# Resubmit DLQ messages back to the main queue
36-
dotnet run -- resubmit-dlq -n mynamespace.servicebus.windows.net -q myqueue
53+
sbtools resubmit-dlq -n mynamespace.servicebus.windows.net -q myqueue
3754

3855
# Interactive mode - select which message categories to resubmit
39-
dotnet run -- resubmit-dlq -n mynamespace.servicebus.windows.net -q myqueue -i
56+
sbtools resubmit-dlq -n mynamespace.servicebus.windows.net -q myqueue -i
4057

4158
# Dump DLQ messages to a JSON file
42-
dotnet run -- dump-dlq -n mynamespace.servicebus.windows.net -q myqueue -o dlq-messages.json
59+
sbtools dump-dlq -n mynamespace.servicebus.windows.net -q myqueue -o dlq-messages.json
4360

4461
# Interactive mode - select which message categories to dump
45-
dotnet run -- dump-dlq -n mynamespace.servicebus.windows.net -q myqueue -o dlq-messages.json -i
62+
sbtools dump-dlq -n mynamespace.servicebus.windows.net -q myqueue -o dlq-messages.json -i
4663

4764
# Diagnose DLQ messages using Application Insights
48-
dotnet run -- diagnose-dlq -n mynamespace.servicebus.windows.net -q myqueue \
65+
sbtools diagnose-dlq -n mynamespace.servicebus.windows.net -q myqueue \
4966
-a "/subscriptions/.../resourceGroups/.../providers/microsoft.insights/components/my-app-insights"
5067

5168
# Monitor all queues with live-updating table
52-
dotnet run -- monitor-queues -n mynamespace.servicebus.windows.net
69+
sbtools monitor-queues -n mynamespace.servicebus.windows.net
5370

5471
# Monitor queues matching a pattern with 10-second refresh
55-
dotnet run -- monitor-queues -n mynamespace.servicebus.windows.net -f "order-*" -r 10
72+
sbtools monitor-queues -n mynamespace.servicebus.windows.net -f "order-*" -r 10
5673
```
5774

75+
> **Note:** If running from source instead of the global tool, replace `sbtools` with `dotnet run --` in the commands above.
76+
5877
## Authentication
5978

6079
Uses [DefaultAzureCredential](https://learn.microsoft.com/en-us/dotnet/api/azure.identity.defaultazurecredential). For

0 commit comments

Comments
 (0)