1- name : Publish NuGet Package to GitHub (Tag/Release Versioning )
1+ name : Publish NuGet Package to GitHub (Manual Only )
22
33on :
4- push :
5- tags :
6- - " v*"
7- release :
8- types : [published, prerelease]
94 workflow_dispatch :
5+ inputs :
6+ version :
7+ description : " NuGet version (e.g. 1.8.8 or 1.8.8-rc.1)"
8+ required : true
9+ type : string
1010
1111concurrency :
1212 group : publish-nuget-${{ github.ref }}
@@ -36,32 +36,26 @@ jobs:
3636 fetch-depth : 0
3737 submodules : recursive
3838
39- - name : 🏷️ Resolve package version (tag or release )
39+ - name : 🏷️ Resolve package version (manual input )
4040 id : ver
4141 shell : bash
4242 run : |
4343 set -euo pipefail
4444
45- # Prefer tag name when available (push tags), otherwise use release tag
46- tag="${GITHUB_REF_NAME:-}"
47- if [[ "${{ github.event_name }}" == "release" ]]; then
48- tag="${{ github.event.release.tag_name }}"
49- fi
45+ ver="${{ github.event.inputs.version }}"
5046
51- if [[ -z "${tag :-}" ]]; then
52- echo "::error::Could not resolve version tag from event. "
47+ if [[ -z "${ver :-}" ]]; then
48+ echo "::error::Missing required input: version"
5349 exit 1
5450 fi
5551
56- # Accept v1.2.3, also allow prerelease/build: v1.2.3-rc.1
57- ver="${tag#v}"
58-
52+ # Accept 1.2.3, also allow prerelease/build: 1.2.3-rc.1
5953 if ! [[ "$ver" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
60- echo "::error::Invalid version derived from tag : '$ver' (tag='$tag') . Expected vMAJOR .MINOR.PATCH (optionally -prerelease)."
54+ echo "::error::Invalid version: '$ver'. Expected MAJOR .MINOR.PATCH (optionally -prerelease)."
6155 exit 1
6256 fi
6357
64- echo "tag=$tag " >> "$GITHUB_OUTPUT"
58+ echo "tag=" >> "$GITHUB_OUTPUT"
6559 echo "version=$ver" >> "$GITHUB_OUTPUT"
6660 echo "Resolved version: $ver"
6761
@@ -114,7 +108,7 @@ jobs:
114108 cp LICENSE.txt "${STAGE_DIR}/LICENSE.txt"
115109 cp icon.png "${STAGE_DIR}/icon.png"
116110
117- - name : ✍️ Patch .nuspec version to tag version
111+ - name : ✍️ Patch .nuspec version to input version
118112 shell : bash
119113 run : |
120114 set -euo pipefail
@@ -126,7 +120,6 @@ jobs:
126120 "$nuspec"
127121
128122 echo "Nuspec version patched to: ${{ steps.ver.outputs.version }}"
129- # Show patched value (sanity check)
130123 xmlstarlet sel -N n="$NS" -t -v "normalize-space(//n:package/n:metadata/n:version)" "$nuspec" && echo ""
131124
132125 - name : 🔎 Validate .nuspec metadata (readme / repository / license / icon)
0 commit comments