Skip to content

Commit cb1f5eb

Browse files
StevenTCramerclaude
andcommitted
Replace separate CI/CD workflows with unified workflow
Following the Nuru repository pattern, consolidate ci-build.yml and release-build.yml into a single ci-cd.yml workflow. Changes: - Create unified ci-cd.yml that runs on PRs, master push, and releases - Build and test always run for validation - Publishing to NuGet only happens on GitHub release creation - Remove old ci-build.yml and release-build.yml - Update to .NET 10.0.x - Use artifacts/packages/ output path - Add path filtering to skip unnecessary runs - Upload build artifacts for all runs (helps debugging) Benefits: - Single source of truth for build/test/publish logic - Better control: publish only when explicitly creating a release - Consistent with other TimeWarp repositories - Reduced maintenance overhead 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ddcea1b commit cb1f5eb

3 files changed

Lines changed: 82 additions & 162 deletions

File tree

.github/workflows/ci-build.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/ci-cd.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: NuGet Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- 'Source/**'
9+
- 'Tests/**'
10+
- '.github/workflows/**'
11+
- 'Directory.Build.props'
12+
- 'Directory.Packages.props'
13+
pull_request:
14+
branches:
15+
- master
16+
paths:
17+
- 'Source/**'
18+
- 'Tests/**'
19+
- '.github/workflows/**'
20+
- 'Directory.Build.props'
21+
- 'Directory.Packages.props'
22+
release:
23+
types: [published] # Triggered when a release is published via GitHub Releases UI or gh CLI
24+
workflow_dispatch:
25+
inputs:
26+
version:
27+
description: 'Version to publish (e.g., 1.0.0-beta.3)'
28+
required: false
29+
type: string
30+
31+
jobs:
32+
build-and-publish:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
39+
40+
- name: Setup .NET
41+
uses: actions/setup-dotnet@v4
42+
with:
43+
dotnet-version: '10.0.x'
44+
45+
- name: Create artifacts directory
46+
run: mkdir -p artifacts/packages
47+
48+
- name: Build
49+
run: dotnet build --configuration Release
50+
51+
- name: Test
52+
run: |
53+
cd Tests/TimeWarp.OptionsValidation.Tests
54+
dotnet tool restore
55+
dotnet restore
56+
dotnet fixie --configuration Release
57+
58+
- name: Publish to NuGet.org (Releases only)
59+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.version != '')
60+
run: |
61+
# Get version from either release tag or manual input
62+
if [ "${{ github.event_name }}" == "release" ]; then
63+
VERSION="${{ github.event.release.tag_name }}"
64+
VERSION="${VERSION#v}" # Remove 'v' prefix if present
65+
else
66+
VERSION="${{ github.event.inputs.version }}"
67+
fi
68+
69+
echo "Publishing version: $VERSION"
70+
71+
dotnet nuget push artifacts/packages/TimeWarp.OptionsValidation.$VERSION.nupkg \
72+
--api-key ${{ secrets.PUBLISH_TO_NUGET_ORG }} \
73+
--source https://api.nuget.org/v3/index.json \
74+
--skip-duplicate
75+
env:
76+
DOTNET_NUGET_SIGNATURE_VERIFICATION: false
77+
78+
- name: Upload Artifacts
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: Packages-${{ github.run_number }}
82+
path: artifacts/packages/*.nupkg

.github/workflows/release-build.yml

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)