Skip to content

Commit

Permalink
ci: use output from nbgv instead of env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
egil committed Oct 4, 2024
1 parent adf989b commit 96dba79
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 21 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
- name: ⚙️ Setup GIT versioning
uses: dotnet/nbgv@v0.4.2
id: nbgv
with:
setAllVars: true

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

# Create the NuGet package in the folder from the environment variable NuGetDirectory
Expand Down Expand Up @@ -235,15 +236,23 @@ jobs:
- name: ⚙️ Setup GIT versioning
uses: dotnet/nbgv@v0.4.2
id: nbgv
with:
setAllVars: true

- name: 🛠️ Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: Unreleased
path: ./CHANGELOG.md

- name: 🍥 Replace tokens in files
uses: cschleiden/replace-tokens@v1
with:
files: '["docs/site/*.md", "docs/**/*.md", "docs/**/*.tmpl.partial", "*.csproj", "**/*.csproj", "src/Directory.Build.props", "docs/site/docfx.json"]'
env:
RELEASE_VERSION: ${{ env.NBGV_SimpleVersion }}${{ env.NBGV_PrereleaseVersion }}
RELEASE_VERSION: ${{ steps.nbgv.outputs.SimpleVersion }}${{ steps.nbgv.outputs.PrereleaseVersion }}
RELEASE_NOTES: ${{ steps.changelog_reader.outputs.changes }}

- name: 📄 Build bUnit
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
- name: ⚙️ Setup GIT versioning
uses: dotnet/nbgv@v0.4.2
id: nbgv
with:
setAllVars: true

Expand Down Expand Up @@ -123,9 +124,8 @@ jobs:
- name: ⏭ Create pull request from stable to main when direct merge fails
if: steps.mergeMainline.outcome == 'failure'
uses: thomaseizinger/create-pull-request@1.4.0
env:
GITHUB_TOKEN: ${{ secrets.BUNIT_BOT_TOKEN }}
with:
github_token: ${{ secrets.BUNIT_BOT_TOKEN }}
head: stable
base: main
title: Update main with documentation in stable
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
version: Unreleased
path: ./CHANGELOG.md

- name: ⚙️ Setup GIT versioning
uses: dotnet/nbgv@v0.4.2
id: nbgv
with:
setAllVars: true

- name: ☑ Check that release contains changes
if: steps.changelog_reader.outputs.changes == ''
run: |
Expand Down Expand Up @@ -85,12 +91,11 @@ jobs:

- name: ⏭ Create pull request for release branch
uses: thomaseizinger/create-pull-request@1.4.0
env:
GITHUB_TOKEN: ${{ secrets.BUNIT_BOT_TOKEN }}
with:
head: release/v${{ env.NBGV_MajorMinorVersion }}
github_token: ${{ secrets.BUNIT_BOT_TOKEN }}
head: release/v${{ steps.nbgv.outputs.MajorMinorVersion }}
base: stable
title: Release of new ${{ github.event.inputs.versionIncrement }} version v${{ env.NBGV_MajorMinorVersion }}
title: Release of new ${{ github.event.inputs.versionIncrement }} version v${{ steps.nbgv.outputs.MajorMinorVersion }}
body: |
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 }}).
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/rebase-v2-on-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ jobs:
- name: ⏭ Create pull request
if: steps.rebaseV2.outcome == 'failure'
uses: thomaseizinger/create-pull-request@1.4.0
env:
GITHUB_TOKEN: ${{ secrets.BUNIT_BOT_TOKEN }}
with:
github_token: ${{ secrets.BUNIT_BOT_TOKEN }}
head: main
base: v2
title: Rebase v2 on main
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
- name: ⚙️ Setup GIT versioning
uses: dotnet/nbgv@v0.4.2
id: nbgv
with:
setAllVars: true

Expand All @@ -67,7 +68,7 @@ jobs:
- name: 🛠️ Update changelog
uses: thomaseizinger/keep-a-changelog-new-release@3.1.0
with:
version: ${{ env.NBGV_SemVer2 }}
version: ${{ steps.nbgv.outputs.SemVer2 }}

- name: 🛠️ Update changelog compare URLs
shell: bash
Expand All @@ -78,22 +79,22 @@ jobs:
- name: 🛠️ Commit CHANGELOG.md to stable branch
run: |
git add CHANGELOG.md
git commit -S -m "Updated CHANGELOG.md for ${{ env.NBGV_SimpleVersion }} release"
git commit -S -m "Updated CHANGELOG.md for ${{ steps.nbgv.outputs.SimpleVersion }} release"
echo "RELEASE_COMMIT_HASH=$(git rev-parse stable)" >> $GITHUB_ENV
- name: 🛠️ Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ env.NBGV_SemVer2 }}
version: ${{ steps.nbgv.outputs.SemVer2 }}
path: ./CHANGELOG.md

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

- name: 🛠️ Packing library in release mode
Expand All @@ -113,13 +114,13 @@ jobs:
- name: 🛠️ Create GitHub release
uses: thomaseizinger/create-release@2.0.0
with:
tag_name: v${{ env.NBGV_SemVer2 }}
tag_name: v${{ steps.nbgv.outputs.SemVer2 }}
target_commitish: ${{ env.RELEASE_COMMIT_HASH }}
name: ${{ env.NBGV_SemVer2 }}
name: ${{ steps.nbgv.outputs.SemVer2 }}
body: ${{ steps.changelog_reader.outputs.changes }}
draft: false
prerelease: ${{ env.NBGV_PublicRelease == 'False' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{ steps.nbgv.outputs.PublicRelease == 'False' }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: ⏩ Merge stable with main, push to origin
id: mergeMainline
Expand All @@ -132,12 +133,11 @@ jobs:
- name: ⏭ Create pull request from stable to main when direct merge fails
if: steps.mergeMainline.outcome == 'failure'
uses: thomaseizinger/create-pull-request@1.4.0
env:
GITHUB_TOKEN: ${{ secrets.BUNIT_BOT_TOKEN }}
with:
github_token: ${{ secrets.BUNIT_BOT_TOKEN }}
head: stable
base: main
title: Update main with changes in stable after v${{ env.NBGV_SemVer2 }} release
title: Update main with changes in stable after v${{ steps.nbgv.outputs.SemVer2 }} release
reviewers: ${{ github.actor }} # By default, we request a review from the person who triggered the workflow.
body: |
Hi @${{ github.actor }}
Expand Down

0 comments on commit 96dba79

Please sign in to comment.