Skip to content

Commit 47962b0

Browse files
Merge branch 'develop'
2 parents 4515995 + fd068be commit 47962b0

2 files changed

Lines changed: 34 additions & 11 deletions

File tree

.github/workflows/nbgv_dotnet_pack.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ on:
4242
NUGET_API_KEY:
4343
description: "API key for pushing to NuGet.org"
4444
required: true
45+
GH_TOKEN:
46+
description: "GitHub token (falls back to github.token)"
47+
required: false
4548
jobs:
4649
pack:
4750
runs-on: ubuntu-latest
@@ -70,13 +73,11 @@ jobs:
7073

7174
- name: 📦 Pack
7275
run: |
73-
# symbols/source only when caller asks
7476
EXTRA_FLAGS=""
7577
if [ "${{ inputs.force_dev_prerelease }}" = "true" ]; then
7678
EXTRA_FLAGS="--include-symbols --include-source"
7779
fi
7880
79-
# PublicRelease strips commit-height *only* on Release builds
8081
PUBLIC_RELEASE_FLAG=""
8182
if [ "${{ inputs.build_configuration }}" = "Release" ]; then
8283
PUBLIC_RELEASE_FLAG="-p:PublicRelease=true"
@@ -87,6 +88,8 @@ jobs:
8788
--output ./artifacts \
8889
$PUBLIC_RELEASE_FLAG \
8990
$EXTRA_FLAGS
91+
-p:PackageVersion=${{ inputs.semver2 }} \
92+
-p:PackageReleaseNotes="https://github.com/${{ github.repository }}/releases/tag/${{ inputs.tag_name }}"
9093
9194
- name: 🚀 Publish to NuGet
9295
if: ${{ inputs.push_after_pack }}
@@ -139,3 +142,12 @@ jobs:
139142
--api-key "$NUGET_API_KEY"
140143
done <<< "$to_delete"
141144
done
145+
146+
- name: 🚀 Create GitHub Release
147+
uses: softprops/action-gh-release@v2
148+
with:
149+
tag_name: ${{ inputs.tag_name }}
150+
body_path: release-notes.md
151+
prerelease: ${{ contains(inputs.semver2, '-') }}
152+
env:
153+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || github.token }}

.github/workflows/nbgv_prepare_release.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,25 +70,36 @@ jobs:
7070
[ "$INC" = "patch" ] && INC=revision
7171
echo "inc=$INC" >> "$GITHUB_OUTPUT"
7272
73-
# 5️⃣ Install NBGV CLI
73+
# 5️⃣ Install the NBGV CLI
7474
- name: 🔧 Install NBGV CLI
7575
run: dotnet tool install -g nbgv --version 3.8.38-alpha
7676

77-
- name: ⚙️ Configure Git for commits
78-
run: |
79-
git config user.name "release-bot"
80-
git config user.email "release-bot@users.noreply.github.com"
81-
82-
# 6️⃣ Bump version and create the release branch
77+
# 6️⃣ Prepare the release branch with an explicit patch bump
8378
- name: 🛠️ Prepare release branch
8479
id: prep_release
8580
run: |
81+
set -euo pipefail
82+
83+
# Determine a prerelease tag only for non-main branches
8684
TAG_ARG=""
8785
if [[ "${{ inputs.target_branch }}" != "main" && "${{ inputs.target_branch }}" != "master" ]]; then
88-
TAG_ARG="dev" # or whatever prerelease you want
86+
TAG_ARG="dev"
8987
fi
9088
91-
nbgv prepare-release $TAG_ARG -p .
89+
# 1) Read the current SemVer2 (e.g. "1.0.0")
90+
CURRENT=$(nbgv get-version -v SemVer2)
91+
92+
# 2) Split and bump the patch segment
93+
IFS='.' read -r MAJ MIN PATCH <<< "$CURRENT"
94+
NEXT="$MAJ.$MIN.$((PATCH + 1))"
95+
echo "Calculated next version: $NEXT"
96+
97+
# 3) Call prepare-release with --nextVersion
98+
nbgv prepare-release $TAG_ARG \
99+
--nextVersion "$NEXT" \
100+
-p .
101+
102+
# 4) Expose the branch name for downstream jobs
92103
echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> "$GITHUB_OUTPUT"
93104
94105
# 7️⃣ Resolve the exact tag & SemVer2

0 commit comments

Comments
 (0)