From 307c35d343b4dd9965249b98ba37d70a7840b8a2 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Mon, 12 Aug 2024 12:37:54 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20update=20envir?= =?UTF-8?q?onment=20variables=20and=20conditional=20checks=20in=20GitHub?= =?UTF-8?q?=20Actions=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing GitVersion environment variables to ensure proper versioning in the workflow. Correct conditional checks to use the correct output variables from the Setup job. These changes ensure that the workflow correctly handles versioning and conditional execution based on the appropriate output variables, improving the reliability and accuracy of the CI/CD pipeline. --- .github/workflows/main.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3cd01b19..30c32f915 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -303,6 +303,11 @@ jobs: files: '["**/*.html"]' tokenPrefix: "${" tokenSuffix: "}" + env: + GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} + GitVersion_AssemblySemVer: ${{ needs.Setup.outputs.GitVersion_AssemblySemVer }} + GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }} + GitVersion.SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} - uses: igsekor/pyspelling-any@v1.0.4 id: spellcheck name: Spellcheck @@ -325,11 +330,8 @@ jobs: GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }} GitVersion_NuGetVersion: ${{ needs.Setup.outputs.GitVersion_NuGetVersion }} GitVersion_PreReleaseLabel: ${{ needs.Setup.outputs.GitVersion_PreReleaseLabel }} - HasChanged_src: ${{ needs.Setup.outputs.HasChanged_src }} - HasChanged_docs: ${{ needs.Setup.outputs.HasChanged_docs }} - HasChanged_automation: ${{ needs.Setup.outputs.HasChanged_automation }} needs: [build, Setup] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && ( needs.Setup.outputs.HasChanged_src == 'true' ) }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && ( needs.Setup.outputs.nkdAgility_HasChanged_src == 'true' ) }} steps: - uses: actions/download-artifact@v4 with: @@ -405,7 +407,7 @@ jobs: name: "Release to Marketplace" runs-on: ubuntu-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.HasChanged_src == 'true') }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') }} steps: - name: Checkout uses: actions/checkout@v2 @@ -434,7 +436,7 @@ jobs: name: "Release to Chocolatey" runs-on: windows-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.HasChanged_src == 'true') }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') }} steps: - uses: actions/download-artifact@v4 with: @@ -458,7 +460,7 @@ jobs: name: "Release to Winget" runs-on: windows-latest needs: [Setup, GitHubRelease] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.HasChanged_src == 'true') }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.nkdAgility_HasChanged_src == 'true') }} steps: - name: Checkout uses: actions/checkout@v2 @@ -479,7 +481,7 @@ jobs: name: "Release to Docs" runs-on: ubuntu-latest needs: [Setup, BuildDocs, GitHubRelease] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.HasChanged_docs == 'true') }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && (needs.Setup.outputs.nkdAgility_HasChanged_docs == 'true') }} steps: - name: Download a single artifact uses: actions/download-artifact@v4 From 5f17b77423cbd4ca9cc9417b1237204b5ef4b516 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Mon, 12 Aug 2024 12:38:29 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20update=20token?= =?UTF-8?q?=20prefix=20and=20suffix=20for=20replace-tokens=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the token prefix and suffix from `${` and `}` to `#{` and `}#` to avoid conflicts with other templating systems or variables that use the `${}` syntax. This ensures that the token replacement process is more reliable and less prone to errors. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 30c32f915..95fb3950f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -301,8 +301,8 @@ jobs: - uses: cschleiden/replace-tokens@v1 with: files: '["**/*.html"]' - tokenPrefix: "${" - tokenSuffix: "}" + tokenPrefix: "#{" + tokenSuffix: "}#" env: GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} GitVersion_AssemblySemVer: ${{ needs.Setup.outputs.GitVersion_AssemblySemVer }}