Skip to content

Commit d2aa5d8

Browse files
Update nbgv_prepare_release.yml
1 parent 2805834 commit d2aa5d8

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,74 @@
11
name: nbgv_prepare_release
2+
23
on:
34
workflow_call:
45
inputs:
56
target_branch:
6-
description: "Branch or tag to release from"
7-
required: false
87
type: string
8+
description: "Branch / tag to release from"
99
default: main
10+
required: true
1011

11-
increment:
12-
description: "Version bump (major, minor, patch)"
13-
required: false
12+
increment:
1413
type: string
14+
description: "Version increment"
1515
default: patch
16+
required: true
17+
18+
outputs:
19+
release_branch:
20+
description: "Name of the new release branch"
21+
value: ${{ jobs.prep.outputs.release_branch }}
1622

1723
secrets:
1824
GH_TOKEN:
19-
description: "PAT if you need extra scopes; default token works in most orgs"
2025
required: false
2126

2227
jobs:
23-
prepare-release:
28+
prep:
2429
runs-on: ubuntu-latest
2530
env:
2631
DOTNET_NOLOGO: true
2732
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
2833

34+
outputs:
35+
release_branch: ${{ steps.prepare.outputs.release_branch }}
36+
2937
steps:
30-
# 1️⃣ checkout chosen ref with full history
31-
- name: ⬇️ Checkout
32-
uses: actions/checkout@v4
38+
# Checkout the branch/tag supplied by the caller
39+
- uses: actions/checkout@v4
3340
with:
3441
ref: ${{ inputs.target_branch }}
3542
fetch-depth: 0
3643
token: ${{ env.GH_TOKEN }}
3744

38-
# 2️⃣ .NET 9 SDK + nbgv CLI
39-
- name: 🛠️ Setup .NET 9
40-
uses: actions/setup-dotnet@v4
41-
with:
42-
dotnet-version: 9.0.x
43-
44-
- name: 🔧 Restore local tools
45-
run: dotnet tool restore
45+
# .NET SDK & nbgv CLI
46+
- uses: actions/setup-dotnet@v4
47+
with: { dotnet-version: 9.0.x }
48+
- run: dotnet tool restore
4649

47-
# 3️⃣ bump version & create release branch
50+
# bump version + create release/vX.Y
4851
- name: 🗂️ Prepare release
4952
id: prepare
5053
run: |
5154
git config user.name "release-bot"
5255
git config user.email "[email protected]"
5356
54-
# map UI term 'patch' -> CLI term 'revision'
5557
INC=${{ inputs.increment }}
56-
[ "$INC" = "patch" ] && INC=revision
58+
[ "$INC" = "patch" ] && INC=revision # map to CLI terminology
5759
dotnet nbgv prepare-release --versionIncrement "$INC"
60+
5861
echo "release_branch=$(git rev-parse --abbrev-ref HEAD)" >> "$GITHUB_OUTPUT"
5962
60-
# 4️⃣ push both branches + tags
61-
- name: 🚀 Push branches & tags
62-
run: |
63-
git push --follow-tags origin ${{ inputs.target_branch }}
64-
git push --follow-tags origin ${{ steps.prep.outputs.release_branch }}
63+
# Push branches & tags and open draft PR
64+
- run: |
65+
git push --follow-tags origin "${{ inputs.target_branch }}"
66+
git push --follow-tags origin "${{ steps.prepare.outputs.release_branch }}"
6567
66-
# 5️⃣ draft PR release/* -> target_branch
67-
- name: 💬 Open pull request
68-
run: |
68+
- run: |
6969
gh pr create \
70-
--base ${{ inputs.target_branch }} \
71-
--head ${{ steps.prep.outputs.release_branch }} \
72-
--title "📦 Release ${{ steps.prep.outputs.release_branch }}" \
73-
--body "Auto-generated release PR for **${{ steps.prep.outputs.release_branch }}**." \
70+
--base "${{ inputs.target_branch }}" \
71+
--head "${{ steps.prepare.outputs.release_branch }}" \
72+
--title "📦 Release ${steps.prepare.outputs.release_branch}" \
73+
--body "Auto-generated release PR." \
7474
--draft

0 commit comments

Comments
 (0)