Skip to content

Commit 96dba79

Browse files
committed
ci: use output from nbgv instead of env variables
1 parent adf989b commit 96dba79

File tree

5 files changed

+34
-21
lines changed

5 files changed

+34
-21
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
5454
- name: ⚙️ Setup GIT versioning
5555
uses: dotnet/[email protected]
56+
id: nbgv
5657
with:
5758
setAllVars: true
5859

@@ -68,7 +69,7 @@ jobs:
6869
with:
6970
files: '["docs/site/*.md", "docs/**/*.md", "docs/**/*.tmpl.partial", "*.csproj", "**/*.csproj", "src/Directory.Build.props"]'
7071
env:
71-
RELEASE_VERSION: ${{ env.NBGV_SimpleVersion }}${{ env.NBGV_PrereleaseVersion }}
72+
RELEASE_VERSION: ${{ steps.nbgv.outputs.SimpleVersion }}${{ steps.nbgv.outputs.PrereleaseVersion }}
7273
RELEASE_NOTES: ${{ steps.changelog_reader.outputs.changes }}
7374

7475
# Create the NuGet package in the folder from the environment variable NuGetDirectory
@@ -235,15 +236,23 @@ jobs:
235236
236237
- name: ⚙️ Setup GIT versioning
237238
uses: dotnet/[email protected]
239+
id: nbgv
238240
with:
239241
setAllVars: true
240242

243+
- name: 🛠️ Get Changelog Entry
244+
id: changelog_reader
245+
uses: mindsers/changelog-reader-action@v2
246+
with:
247+
version: Unreleased
248+
path: ./CHANGELOG.md
249+
241250
- name: 🍥 Replace tokens in files
242251
uses: cschleiden/replace-tokens@v1
243252
with:
244253
files: '["docs/site/*.md", "docs/**/*.md", "docs/**/*.tmpl.partial", "*.csproj", "**/*.csproj", "src/Directory.Build.props", "docs/site/docfx.json"]'
245254
env:
246-
RELEASE_VERSION: ${{ env.NBGV_SimpleVersion }}${{ env.NBGV_PrereleaseVersion }}
255+
RELEASE_VERSION: ${{ steps.nbgv.outputs.SimpleVersion }}${{ steps.nbgv.outputs.PrereleaseVersion }}
247256
RELEASE_NOTES: ${{ steps.changelog_reader.outputs.changes }}
248257

249258
- name: 📄 Build bUnit

.github/workflows/docs-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
5252
- name: ⚙️ Setup GIT versioning
5353
uses: dotnet/[email protected]
54+
id: nbgv
5455
with:
5556
setAllVars: true
5657

@@ -123,9 +124,8 @@ jobs:
123124
- name: ⏭ Create pull request from stable to main when direct merge fails
124125
if: steps.mergeMainline.outcome == 'failure'
125126
uses: thomaseizinger/[email protected]
126-
env:
127-
GITHUB_TOKEN: ${{ secrets.BUNIT_BOT_TOKEN }}
128127
with:
128+
github_token: ${{ secrets.BUNIT_BOT_TOKEN }}
129129
head: stable
130130
base: main
131131
title: Update main with documentation in stable

.github/workflows/prepare-release.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ jobs:
2828
version: Unreleased
2929
path: ./CHANGELOG.md
3030

31+
- name: ⚙️ Setup GIT versioning
32+
uses: dotnet/[email protected]
33+
id: nbgv
34+
with:
35+
setAllVars: true
36+
3137
- name: ☑ Check that release contains changes
3238
if: steps.changelog_reader.outputs.changes == ''
3339
run: |
@@ -85,12 +91,11 @@ jobs:
8591

8692
- name: ⏭ Create pull request for release branch
8793
uses: thomaseizinger/[email protected]
88-
env:
89-
GITHUB_TOKEN: ${{ secrets.BUNIT_BOT_TOKEN }}
9094
with:
91-
head: release/v${{ env.NBGV_MajorMinorVersion }}
95+
github_token: ${{ secrets.BUNIT_BOT_TOKEN }}
96+
head: release/v${{ steps.nbgv.outputs.MajorMinorVersion }}
9297
base: stable
93-
title: Release of new ${{ github.event.inputs.versionIncrement }} version v${{ env.NBGV_MajorMinorVersion }}
98+
title: Release of new ${{ github.event.inputs.versionIncrement }} version v${{ steps.nbgv.outputs.MajorMinorVersion }}
9499
body: |
95100
This PR was created in response to a manual trigger of the [prepare-release workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
96101

.github/workflows/rebase-v2-on-main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ jobs:
4848
- name: ⏭ Create pull request
4949
if: steps.rebaseV2.outcome == 'failure'
5050
uses: thomaseizinger/[email protected]
51-
env:
52-
GITHUB_TOKEN: ${{ secrets.BUNIT_BOT_TOKEN }}
5351
with:
52+
github_token: ${{ secrets.BUNIT_BOT_TOKEN }}
5453
head: main
5554
base: v2
5655
title: Rebase v2 on main

.github/workflows/release.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
5151
- name: ⚙️ Setup GIT versioning
5252
uses: dotnet/[email protected]
53+
id: nbgv
5354
with:
5455
setAllVars: true
5556

@@ -67,7 +68,7 @@ jobs:
6768
- name: 🛠️ Update changelog
6869
uses: thomaseizinger/[email protected]
6970
with:
70-
version: ${{ env.NBGV_SemVer2 }}
71+
version: ${{ steps.nbgv.outputs.SemVer2 }}
7172

7273
- name: 🛠️ Update changelog compare URLs
7374
shell: bash
@@ -78,22 +79,22 @@ jobs:
7879
- name: 🛠️ Commit CHANGELOG.md to stable branch
7980
run: |
8081
git add CHANGELOG.md
81-
git commit -S -m "Updated CHANGELOG.md for ${{ env.NBGV_SimpleVersion }} release"
82+
git commit -S -m "Updated CHANGELOG.md for ${{ steps.nbgv.outputs.SimpleVersion }} release"
8283
echo "RELEASE_COMMIT_HASH=$(git rev-parse stable)" >> $GITHUB_ENV
8384
8485
- name: 🛠️ Get Changelog Entry
8586
id: changelog_reader
8687
uses: mindsers/changelog-reader-action@v2
8788
with:
88-
version: ${{ env.NBGV_SemVer2 }}
89+
version: ${{ steps.nbgv.outputs.SemVer2 }}
8990
path: ./CHANGELOG.md
9091

9192
- name: 🛠️ Update tokens in project files
9293
uses: cschleiden/replace-tokens@v1
9394
with:
9495
files: '["docs/site/*.md", "docs/**/*.md", "docs/**/*.tmpl.partial", "*.csproj", "**/*.csproj", "src/Directory.Build.props"]'
9596
env:
96-
RELEASE_VERSION: ${{ env.NBGV_NuGetPackageVersion }}
97+
RELEASE_VERSION: ${{ steps.nbgv.outputs.NuGetPackageVersion }}
9798
RELEASE_NOTES: ${{ steps.changelog_reader.outputs.changes }}
9899

99100
- name: 🛠️ Packing library in release mode
@@ -113,13 +114,13 @@ jobs:
113114
- name: 🛠️ Create GitHub release
114115
uses: thomaseizinger/[email protected]
115116
with:
116-
tag_name: v${{ env.NBGV_SemVer2 }}
117+
tag_name: v${{ steps.nbgv.outputs.SemVer2 }}
117118
target_commitish: ${{ env.RELEASE_COMMIT_HASH }}
118-
name: ${{ env.NBGV_SemVer2 }}
119+
name: ${{ steps.nbgv.outputs.SemVer2 }}
119120
body: ${{ steps.changelog_reader.outputs.changes }}
120121
draft: false
121-
prerelease: ${{ env.NBGV_PublicRelease == 'False' }}
122-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
prerelease: ${{ steps.nbgv.outputs.PublicRelease == 'False' }}
123+
github_token: ${{ secrets.GITHUB_TOKEN }}
123124

124125
- name: ⏩ Merge stable with main, push to origin
125126
id: mergeMainline
@@ -132,12 +133,11 @@ jobs:
132133
- name: ⏭ Create pull request from stable to main when direct merge fails
133134
if: steps.mergeMainline.outcome == 'failure'
134135
uses: thomaseizinger/[email protected]
135-
env:
136-
GITHUB_TOKEN: ${{ secrets.BUNIT_BOT_TOKEN }}
137136
with:
137+
github_token: ${{ secrets.BUNIT_BOT_TOKEN }}
138138
head: stable
139139
base: main
140-
title: Update main with changes in stable after v${{ env.NBGV_SemVer2 }} release
140+
title: Update main with changes in stable after v${{ steps.nbgv.outputs.SemVer2 }} release
141141
reviewers: ${{ github.actor }} # By default, we request a review from the person who triggered the workflow.
142142
body: |
143143
Hi @${{ github.actor }}

0 commit comments

Comments
 (0)