From 96dba795bfb0a8628a678f7b583adb544e923714 Mon Sep 17 00:00:00 2001 From: Egil Hansen Date: Tue, 24 Sep 2024 21:20:41 +0000 Subject: [PATCH] ci: use output from nbgv instead of env variables --- .github/workflows/ci.yml | 13 +++++++++++-- .github/workflows/docs-deploy.yml | 4 ++-- .github/workflows/prepare-release.yml | 13 +++++++++---- .github/workflows/rebase-v2-on-main.yml | 3 +-- .github/workflows/release.yml | 22 +++++++++++----------- 5 files changed, 34 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2503768d3..f239925d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,7 @@ jobs: - name: ⚙️ Setup GIT versioning uses: dotnet/nbgv@v0.4.2 + id: nbgv with: setAllVars: true @@ -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 @@ -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 diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index bd0cf29b3..93cdde359 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -51,6 +51,7 @@ jobs: - name: ⚙️ Setup GIT versioning uses: dotnet/nbgv@v0.4.2 + id: nbgv with: setAllVars: true @@ -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 diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 37c77fc79..5b48c8c0f 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -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: | @@ -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 }}). diff --git a/.github/workflows/rebase-v2-on-main.yml b/.github/workflows/rebase-v2-on-main.yml index 11178ce44..2786b4db7 100644 --- a/.github/workflows/rebase-v2-on-main.yml +++ b/.github/workflows/rebase-v2-on-main.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb6882b43..b93f5fbca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,6 +50,7 @@ jobs: - name: ⚙️ Setup GIT versioning uses: dotnet/nbgv@v0.4.2 + id: nbgv with: setAllVars: true @@ -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 @@ -78,14 +79,14 @@ 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 @@ -93,7 +94,7 @@ jobs: 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 @@ -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 @@ -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 }}