-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (133 loc) · 4.55 KB
/
Copy pathdotnet-release.yml
File metadata and controls
151 lines (133 loc) · 4.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# =============================================================================
# Release Workflow - LIB-Shared-NET
# =============================================================================
# Complete CI/CD workflow for the shared platform libraries using reusable
# workflows from bauer-group/automation-templates:
# - PR validation (build & test)
# - Semantic versioning (conventional commits)
# - Automatic release creation
# - NuGet publishing to NuGet.org and GitHub Packages
# - Assembly signing with SNK key
#
# Uses conventional commits for automatic version bumping:
# - feat: -> minor version bump
# - fix: -> patch version bump
# - feat!: or BREAKING CHANGE: -> major version bump
#
# Required Secrets:
# - NUGET_API_KEY: API key for NuGet.org publishing
# - DOTNET_SIGNKEY_BASE64: Base64-encoded SNK key for assembly signing
# =============================================================================
name: 🚀 Release & Publish
on:
push:
branches: [main]
paths-ignore:
- ".github/**"
- "*.md"
- "docs/**"
pull_request:
branches: [main]
paths:
- "src/**"
- "tests/**"
- "*.slnx"
- "Directory.Build.props"
- "Directory.Packages.props"
workflow_dispatch:
inputs:
force-release:
description: "Force create release (even without conventional commits)"
type: boolean
default: false
permissions:
contents: write
packages: write
id-token: write
issues: write
pull-requests: write
security-events: write
jobs:
# ============================================
# Validation (runs on all triggers)
# ============================================
validate:
name: 🔨 Build & Test
uses: bauer-group/automation-templates/.github/workflows/dotnet-build.yml@main
with:
project-path: "BAUERGROUP.Shared.slnx"
dotnet-version: "10.0.x"
run-tests: true
collect-coverage: true
# Windows runner for tests (Windows-specific tests need Windows)
runs-on: "windows-latest"
# SNK path must match AssemblyOriginatorKeyFile in Directory.Build.props
snk-file-path: "build/BAUERGROUP.Shared.snk"
secrets: inherit
# ============================================
# Semantic Release (only on main branch push)
# ============================================
release:
name: 📦 Create Release
needs: validate
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
github.event_name == 'workflow_dispatch'
uses: bauer-group/automation-templates/.github/workflows/modules-semantic-release.yml@main
with:
target-branch: "main"
force-release: ${{ inputs.force-release || false }}
extra-plugins: "semantic-release-dotnet"
secrets: inherit
# ============================================
# Publish NuGet Packages (after release)
# ============================================
publish:
name: 📤 Publish to NuGet & GitHub
needs: release
if: needs.release.outputs.release-created == 'true'
uses: bauer-group/automation-templates/.github/workflows/dotnet-publish-library.yml@main
with:
project-path: "BAUERGROUP.Shared.slnx"
dotnet-version: "10.0.x"
# Version from semantic-release
release-version: ${{ needs.release.outputs.version }}
# Build on Linux (default) - Windows TFMs work via EnableWindowsTargeting
# runs-on: "ubuntu-latest" (default)
# Tests already ran in validate job
run-tests: false
# Assembly signing
sign-assembly: true
# Publishing
push-to-nuget: true
push-to-github: true
nuget-auth-method: "api-key"
# Package options
include-symbols: true
include-source: true
deterministic-build: true
secrets: inherit
# ============================================
# PR Package Validation (only on pull requests)
# ============================================
pr-validate:
name: 📋 Validate Package (PR)
needs: validate
if: github.event_name == 'pull_request'
uses: bauer-group/automation-templates/.github/workflows/dotnet-publish-library.yml@main
with:
project-path: "BAUERGROUP.Shared.slnx"
dotnet-version: "10.0.x"
# Preview version for PR
version-suffix: "pr"
# Build on Linux (default)
# runs-on: "ubuntu-latest" (default)
# Tests already ran in validate job
run-tests: false
# Build and validate package
create-package: true
include-symbols: true
# Don't publish
push-to-nuget: false
push-to-github: false
secrets: inherit