Skip to content

Commit 5fa9396

Browse files
Copilotjaredpar
andauthored
Restore workflow_dispatch trigger with optional version override
Agent-Logs-Url: https://github.com/jaredpar/basic-reference-assemblies/sessions/19a39b49-846f-4b2d-a18a-a157074fe47e Co-authored-by: jaredpar <146967+jaredpar@users.noreply.github.com>
1 parent 75045ec commit 5fa9396

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

.github/workflows/publish.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ name: Publish NuGet Packages
22
on:
33
push:
44
branches: [ main ]
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Package Version (leave blank to auto-increment patch)'
9+
required: false
10+
type: string
11+
default: ''
512

613
jobs:
714
publish:
@@ -15,15 +22,19 @@ jobs:
1522
- name: Compute Next Version
1623
id: version
1724
run: |
18-
latest=$(git tag --list 'v*' --sort=-version:refname | head -n 1)
19-
if [ -z "$latest" ]; then
20-
next="1.0.0"
25+
if [ -n "${{ github.event.inputs.version }}" ]; then
26+
next="${{ github.event.inputs.version }}"
2127
else
22-
version="${latest#v}"
23-
major=$(echo "$version" | cut -d. -f1)
24-
minor=$(echo "$version" | cut -d. -f2)
25-
patch=$(echo "$version" | cut -d. -f3)
26-
next="${major}.${minor}.$((patch + 1))"
28+
latest=$(git tag --list 'v*' --sort=-version:refname | head -n 1)
29+
if [ -z "$latest" ]; then
30+
next="1.0.0"
31+
else
32+
version="${latest#v}"
33+
major=$(echo "$version" | cut -d. -f1)
34+
minor=$(echo "$version" | cut -d. -f2)
35+
patch=$(echo "$version" | cut -d. -f3)
36+
next="${major}.${minor}.$((patch + 1))"
37+
fi
2738
fi
2839
echo "version=${next}" >> "$GITHUB_OUTPUT"
2940

0 commit comments

Comments
 (0)