5858 git config user.name "github-actions[bot]"
5959 git config user.email "github-actions[bot]@users.noreply.github.com"
6060
61- - name : 🔄 Map patch → revision
62- id : map
63- run : |
64- INC="${{ inputs.increment }}"
65- [ "$INC" = "patch" ] && INC=revision
66- echo "inc=$INC" >> "$GITHUB_OUTPUT"
67-
68- - name : 🔧 Install NBGV CLI
69- run : dotnet tool install -g nbgv --version 3.8.38-alpha
70-
71- - name : 🛠️ Prepare release branch
72- id : prep_release
73- run : |
74- set -euo pipefail
75-
76- # 1) Detect prerelease tag only on non-main or master
77- if [[ "${{ inputs.target_branch }}" == "develop" ]]; then
78- # ── Dev flow: bump patch + add "-dev"
79- nbgv prepare-release dev -p .
80- git push --set-upstream origin "$(git rev-parse --abbrev-ref HEAD)"
81- echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> "$GITHUB_OUTPUT"
82- exit 0
83- fi
84-
85- # 2) Read current version, bump patch
86- CURRENT=$(nbgv get-version -v SemVer2)
87- IFS='.' read -r MAJ MIN PATCH <<< "$CURRENT"
88- NEXT="$MAJ.$MIN.$((PATCH + 1))"
89- echo "Calculated next version: $NEXT"
90-
91- # 3) Call prepare-release (no prerelease tag) and capture JSON output
92- JSON_OUTPUT="$(nbgv prepare-release \
93- --nextVersion "$NEXT" \
94- --format json)"
95- echo "$JSON_OUTPUT"
96-
97- # 4) Parse out release branch name
98- RELEASE_BRANCH=$(echo "$JSON_OUTPUT" | jq -r .releaseBranchName)
99- echo "Release branch: $RELEASE_BRANCH"
100-
101- # 5) Push the release branch and updated main
102- git push origin "$RELEASE_BRANCH"
103- git push origin "${{ inputs.target_branch }}"
104-
105- # 6) Expose for downstream jobs
106- echo "branch=$RELEASE_BRANCH" >> "$GITHUB_OUTPUT"
107-
10861 - name : 🔖 Resolve tag & SemVer
10962 id : version
11063 run : |
@@ -120,6 +73,24 @@ jobs:
12073 git push origin 0.0.0
12174 fi
12275
76+ - name : 🛠️ Prepare release
77+ id : prep_release
78+ run : |
79+ set -euo pipefail
80+
81+ # Let Nerdbank.GitVersioning do the right thing for both flows:
82+ # • On main/master/hotfix/* → patch bump, no "-alpha" (stable)
83+ # • On develop (or any other ref) → patch bump + "-alpha"
84+ nbgv prepare-release
85+
86+ # Push the branch & tags so the Pack workflow can see them
87+ BR=$(git rev-parse --abbrev-ref HEAD)
88+ git push --set-upstream origin "$BR"
89+ git push origin --tags
90+
91+ # Expose the branch name for downstream workflows
92+ echo "branch=$BR" >> "$GITHUB_OUTPUT"
93+
12394 - name : 📝 Generate release notes
12495 id : changelog
12596 uses : mikepenz/release-changelog-builder-action@v5
0 commit comments