From 2507da993a17c4c7963bbbced707bccca7a8afe2 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Fri, 9 Feb 2024 01:10:54 -0600 Subject: [PATCH 01/32] Create Action to automatically set LGHA refs to an expected value; Create Workflow to automatically change refs and create a tag --- .../set-gha-refs/Set-Called-GHA-Refs.ps1 | 35 +++++++++++++++ .github/actions/set-gha-refs/action.yml | 44 +++++++++++++++++++ .github/workflows/tag-and-release.yml | 39 ++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 .github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 create mode 100644 .github/actions/set-gha-refs/action.yml create mode 100644 .github/workflows/tag-and-release.yml diff --git a/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 b/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 new file mode 100644 index 000000000..aef6ae260 --- /dev/null +++ b/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 @@ -0,0 +1,35 @@ +param( + [String[]] $CalledRepoBaseIncludeList, + [String[]] $PathIncludeList, + [String[]] $FileIncludeList, + [String] $ExpectedRef +) + +if ($CalledRepoBaseIncludeList.Count -eq 0) +{ + Write-Output '::warning file=Check-Called-GHA-refs.ps1,line10::CalledRepoBaseIncludeList is empty which is unexpected. If this was intentional, you can ignore this warning.' + exit 0 # Nothing to check because array is empty. +} + +$CalledRepoBaseIncludeList = $CalledRepoBaseIncludeList.ForEach({ 'uses:\s*' + $PSItem + '(.*)@(.*)' }) + +$matchedRefs = Get-ChildItem -Path $PathIncludeList -Include $FileIncludeList -Force -Recurse | + Select-String -Pattern $CalledRepoBaseIncludeList + +if ($matchedRefs.Count -gt 0) +{ + + "These called GitHub Actions and Workflows have been explicitly set to ref '$ExpectedRef'." >> $env:GITHUB_STEP_SUMMARY + + foreach ($matched in $matchedRefs) + { + $oldline = $matched.Line + $newline = $matched.Line -Replace '@(.*)', "@$ExpectedRef" + Write-Output $oldline + Write-Output $newline + + $filename = $matched.RelativePath($pwd) + + (Get-Content $filename).Replace($oldline, $newline) | Set-Content $filename + } +} diff --git a/.github/actions/set-gha-refs/action.yml b/.github/actions/set-gha-refs/action.yml new file mode 100644 index 000000000..60d230e5d --- /dev/null +++ b/.github/actions/set-gha-refs/action.yml @@ -0,0 +1,44 @@ +name: Set GitHub Actions References +description: > + Explicitly sets all called GitHub Action and Workflow references to an expected version. + +inputs: + path-include-list: + required: false + default: '@(".github")' + description: > + PowerShell string array of paths, relative to the repository root, to search for GHA files, e.g. '@(".github")' or '@(".github/actions", ".github/workflows")'. The + parameter must be a PowerShell string array. + file-include-list: + required: false + default: '@("*.yml","*.yaml")' + description: > + PowerShell string array of file name patterns to include when evaluating GHA files, e.g. '@("*.yml")' or '@("*.yml", "*.yaml")'. The + parameter must be a PowerShell string array. + called-repo-base-include-list: + required: false + default: '@("${{ github.repository }}")' + description: > + PowerShell string array of repository base URLs to include when evaluating called GHA Workflows and Actions, e.g '@("Lombiq/GitHub-Actions")' or + '@("Lombiq/GitHub-Actions", "Lombiq/Open-Source-Orchard-Core-Extensions")'. The parameter must be a PowerShell string array. + expected-ref: + required: true + description: The expected reference value to set for all called GHA Workflows and Actions. +runs: + using: "composite" + steps: + - name: Setup + shell: pwsh + run: | + "${{ github.action_path }}" >> $Env:GITHUB_PATH + + - name: Set References + shell: pwsh + run: | + $params = @{ + PathIncludeList = ${{ inputs.path-include-list }} + FileIncludeList = ${{ inputs.file-include-list }} + CalledRepoBaseIncludeList = ${{ inputs.called-repo-base-include-list }} + ExpectedRef = "${{ inputs.expected-ref }}" + } + Set-Called-GHA-Refs @params diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml new file mode 100644 index 000000000..77118add1 --- /dev/null +++ b/.github/workflows/tag-and-release.yml @@ -0,0 +1,39 @@ +name: Tag and Release LGHA +on: + push: + branches: + - release/* + +jobs: + run: + name: Update LGHA Refs + runs-on: ubuntu-latest + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository. + contents: write + steps: + - name: Checkout Repository + uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev + with: + token: ${{ secrets.TAG_AND_RELEASE }} + + - name: Determine Version Tag Name from Branch Name + id: determine-tag + shell: pwsh + run: | + $refname = "${{ github.ref_name }}" + $tagname = $refname -replace 'release/', '' + $output = "tagname=$tagname" + Write-Output "output=$output" + $output >> $env:GITHUB_OUTPUT + + - name: Set Ref for GitHub Actions and Workflows + uses: Lombiq/GitHub-Actions/.github/actions/set-gha-refs@issue/OSOE-735 + with: + expected-ref: '${{ steps.determine-tag.outputs.tagname }}' + + - name: Commit and Push Changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Update called GitHub Actions and Workflows to release version + tagging_message: ${{ steps.determine-tag.outputs.tagname }} From 61010f6a534d9584cf607a5f5247d204e6452039 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Fri, 9 Feb 2024 01:22:28 -0600 Subject: [PATCH 02/32] Remove empty lines from tag and release workflow --- .github/workflows/tag-and-release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index 77118add1..eac8f493b 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -16,7 +16,6 @@ jobs: uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev with: token: ${{ secrets.TAG_AND_RELEASE }} - - name: Determine Version Tag Name from Branch Name id: determine-tag shell: pwsh @@ -26,12 +25,10 @@ jobs: $output = "tagname=$tagname" Write-Output "output=$output" $output >> $env:GITHUB_OUTPUT - - name: Set Ref for GitHub Actions and Workflows uses: Lombiq/GitHub-Actions/.github/actions/set-gha-refs@issue/OSOE-735 with: expected-ref: '${{ steps.determine-tag.outputs.tagname }}' - - name: Commit and Push Changes uses: stefanzweifel/git-auto-commit-action@v5 with: From 9c303644de094375654dd592012ca3bf2a0ce37b Mon Sep 17 00:00:00 2001 From: David Puplava Date: Fri, 9 Feb 2024 22:31:35 -0600 Subject: [PATCH 03/32] Refactor based on feedback; Force push changes to tag --- .../set-gha-refs/Set-Called-GHA-Refs.ps1 | 37 +++++++++++-------- .github/workflows/tag-and-release.yml | 9 ++++- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 b/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 index aef6ae260..9954e2673 100644 --- a/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 +++ b/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 @@ -8,28 +8,33 @@ param( if ($CalledRepoBaseIncludeList.Count -eq 0) { Write-Output '::warning file=Check-Called-GHA-refs.ps1,line10::CalledRepoBaseIncludeList is empty which is unexpected. If this was intentional, you can ignore this warning.' - exit 0 # Nothing to check because array is empty. } - -$CalledRepoBaseIncludeList = $CalledRepoBaseIncludeList.ForEach({ 'uses:\s*' + $PSItem + '(.*)@(.*)' }) - -$matchedRefs = Get-ChildItem -Path $PathIncludeList -Include $FileIncludeList -Force -Recurse | - Select-String -Pattern $CalledRepoBaseIncludeList - -if ($matchedRefs.Count -gt 0) +else { + $CalledRepoBaseIncludeList = $CalledRepoBaseIncludeList.ForEach({ 'uses:\s*' + $PSItem + '(.*)@(.*)' }) - "These called GitHub Actions and Workflows have been explicitly set to ref '$ExpectedRef'." >> $env:GITHUB_STEP_SUMMARY + $matchedRefs = Get-ChildItem -Path $PathIncludeList -Include $FileIncludeList -Force -Recurse | + Select-String -Pattern $CalledRepoBaseIncludeList - foreach ($matched in $matchedRefs) + if ($matchedRefs.Count -gt 0) { - $oldline = $matched.Line - $newline = $matched.Line -Replace '@(.*)', "@$ExpectedRef" - Write-Output $oldline - Write-Output $newline + foreach ($matched in $matchedRefs) + { + $oldline = $matched.Line + $newline = $matched.Line -Replace '@(.*)', "@$ExpectedRef" + + if ($oldine -ne $newline) + { + Write-Output "$oldline => $newline" + + $filename = $matched.RelativePath($pwd) + $linenumber = $mismatch.LineNumber + $title = "GHA Ref pinned to '$ExpectedRef'" - $filename = $matched.RelativePath($pwd) + (Get-Content $filename).Replace($oldline, $newline) | Set-Content $filename - (Get-Content $filename).Replace($oldline, $newline) | Set-Content $filename + Write-Output "::notice file=$filename,line=$linenumber,title=$title::GHA Ref changed to '$ExpectedRef'" + } + } } } diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index eac8f493b..197bf1a34 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -2,7 +2,7 @@ name: Tag and Release LGHA on: push: branches: - - release/* + - release/** jobs: run: @@ -32,5 +32,10 @@ jobs: - name: Commit and Push Changes uses: stefanzweifel/git-auto-commit-action@v5 with: - commit_message: Update called GitHub Actions and Workflows to release version + commit_message: 'Pin GitHub Actions and Workflows to ${{ steps.determine-tag.outputs.tagname }}' tagging_message: ${{ steps.determine-tag.outputs.tagname }} + - name: Push Tag (Force) + continue-on-error: true + shell: pwsh + run: | + git push --tags --force From f2c1fbb9c3fd7cb04585951ed03fc6b8a8ee13a1 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Sat, 10 Feb 2024 00:33:46 -0600 Subject: [PATCH 04/32] Handle special GHA refs such as spelling action that explicitly references dev branch files --- .github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 | 10 ++++++++-- .github/actions/set-gha-refs/action.yml | 8 ++++++++ .github/workflows/tag-and-release.yml | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 b/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 index 9954e2673..d2a81eca7 100644 --- a/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 +++ b/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 @@ -1,5 +1,6 @@ param( [String[]] $CalledRepoBaseIncludeList, + [String[]] $AdditionalPatternIncludeList, [String[]] $PathIncludeList, [String[]] $FileIncludeList, [String] $ExpectedRef @@ -11,17 +12,22 @@ if ($CalledRepoBaseIncludeList.Count -eq 0) } else { - $CalledRepoBaseIncludeList = $CalledRepoBaseIncludeList.ForEach({ 'uses:\s*' + $PSItem + '(.*)@(.*)' }) + $CalledRepoBaseIncludeList = $CalledRepoBaseIncludeList.ForEach({ 'uses:\s*' + $PSItem + '.*@(?[aA-zZ,0-9,-,\.,/,_]*)' }) $matchedRefs = Get-ChildItem -Path $PathIncludeList -Include $FileIncludeList -Force -Recurse | Select-String -Pattern $CalledRepoBaseIncludeList + $additionalRefs = Get-ChildItem -Path $PathIncludeList -Include $FileIncludeList -Force -Recurse | + Select-String -Pattern $AdditionalPatternIncludeList + + $matchedRefs = $matchedRefs + $additionalRefs + if ($matchedRefs.Count -gt 0) { foreach ($matched in $matchedRefs) { $oldline = $matched.Line - $newline = $matched.Line -Replace '@(.*)', "@$ExpectedRef" + $newline = $matched.Line -Replace $matched.Matches[0].Groups['ref'].Value, "$ExpectedRef" if ($oldine -ne $newline) { diff --git a/.github/actions/set-gha-refs/action.yml b/.github/actions/set-gha-refs/action.yml index 60d230e5d..f61f2b0e1 100644 --- a/.github/actions/set-gha-refs/action.yml +++ b/.github/actions/set-gha-refs/action.yml @@ -21,6 +21,13 @@ inputs: description: > PowerShell string array of repository base URLs to include when evaluating called GHA Workflows and Actions, e.g '@("Lombiq/GitHub-Actions")' or '@("Lombiq/GitHub-Actions", "Lombiq/Open-Source-Orchard-Core-Extensions")'. The parameter must be a PowerShell string array. + additional-pattern-include-list: + required: false + default: '@()' + description: > + PowerShell string array of additional RegEx patterns to include when searching for branch references that need to be + updated, e.g. 'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github/'. The pattern MUST include a regex named capture group (?[aA-zZ,0-9,-,\.,/,_]*) so the captured ref + can be updated correctly. The parameter must be a PowerShell string array. expected-ref: required: true description: The expected reference value to set for all called GHA Workflows and Actions. @@ -39,6 +46,7 @@ runs: PathIncludeList = ${{ inputs.path-include-list }} FileIncludeList = ${{ inputs.file-include-list }} CalledRepoBaseIncludeList = ${{ inputs.called-repo-base-include-list }} + AdditionalPatternIncludeList = ${{ inputs.additional-pattern-include-list }} ExpectedRef = "${{ inputs.expected-ref }}" } Set-Called-GHA-Refs @params diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index 197bf1a34..cd4794256 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -28,6 +28,7 @@ jobs: - name: Set Ref for GitHub Actions and Workflows uses: Lombiq/GitHub-Actions/.github/actions/set-gha-refs@issue/OSOE-735 with: + additional-pattern-include-list: '@("https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github")' expected-ref: '${{ steps.determine-tag.outputs.tagname }}' - name: Commit and Push Changes uses: stefanzweifel/git-auto-commit-action@v5 From e7f93def21a192cf94c8f4761e24256189b26736 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Sat, 10 Feb 2024 00:41:31 -0600 Subject: [PATCH 05/32] Remove extra whitespace --- .github/actions/set-gha-refs/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/set-gha-refs/action.yml b/.github/actions/set-gha-refs/action.yml index f61f2b0e1..40b5eb78f 100644 --- a/.github/actions/set-gha-refs/action.yml +++ b/.github/actions/set-gha-refs/action.yml @@ -25,7 +25,7 @@ inputs: required: false default: '@()' description: > - PowerShell string array of additional RegEx patterns to include when searching for branch references that need to be + PowerShell string array of additional RegEx patterns to include when searching for branch references that need to be updated, e.g. 'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github/'. The pattern MUST include a regex named capture group (?[aA-zZ,0-9,-,\.,/,_]*) so the captured ref can be updated correctly. The parameter must be a PowerShell string array. expected-ref: From def22e7244f6d42c7951beec3367d2fce645c345 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Tue, 13 Feb 2024 22:35:46 -0600 Subject: [PATCH 06/32] Refactor tag version to be reusable and take a secret; Add starter workflow to run for LGHA repo --- .github/workflows/tag-and-release.yml | 42 ----------------- .github/workflows/tag-version-this-repo.yml | 13 ++++++ .github/workflows/tag-version.yml | 51 +++++++++++++++++++++ 3 files changed, 64 insertions(+), 42 deletions(-) delete mode 100644 .github/workflows/tag-and-release.yml create mode 100644 .github/workflows/tag-version-this-repo.yml create mode 100644 .github/workflows/tag-version.yml diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml deleted file mode 100644 index cd4794256..000000000 --- a/.github/workflows/tag-and-release.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Tag and Release LGHA -on: - push: - branches: - - release/** - -jobs: - run: - name: Update LGHA Refs - runs-on: ubuntu-latest - permissions: - # Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository. - contents: write - steps: - - name: Checkout Repository - uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev - with: - token: ${{ secrets.TAG_AND_RELEASE }} - - name: Determine Version Tag Name from Branch Name - id: determine-tag - shell: pwsh - run: | - $refname = "${{ github.ref_name }}" - $tagname = $refname -replace 'release/', '' - $output = "tagname=$tagname" - Write-Output "output=$output" - $output >> $env:GITHUB_OUTPUT - - name: Set Ref for GitHub Actions and Workflows - uses: Lombiq/GitHub-Actions/.github/actions/set-gha-refs@issue/OSOE-735 - with: - additional-pattern-include-list: '@("https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github")' - expected-ref: '${{ steps.determine-tag.outputs.tagname }}' - - name: Commit and Push Changes - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: 'Pin GitHub Actions and Workflows to ${{ steps.determine-tag.outputs.tagname }}' - tagging_message: ${{ steps.determine-tag.outputs.tagname }} - - name: Push Tag (Force) - continue-on-error: true - shell: pwsh - run: | - git push --tags --force diff --git a/.github/workflows/tag-version-this-repo.yml b/.github/workflows/tag-version-this-repo.yml new file mode 100644 index 000000000..29b2bb721 --- /dev/null +++ b/.github/workflows/tag-version-this-repo.yml @@ -0,0 +1,13 @@ +name: Tag Version (this repo) +on: + push: + branches: + - release/** + +jobs: + run: + name: Tag Version Automation + if: github.event.pusher.name != 'LombiqBot' + uses: Lombiq/GitHub-Actions/.github/workflows/tag-version.yml@issue/OSOE-735 + secrets: + TAG_VERSION_TOKEN: ${{ secrets.LOMBIQBOT_GITHUB_PERSONAL_ACCESS_TOKEN }} diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml new file mode 100644 index 000000000..974bd96b2 --- /dev/null +++ b/.github/workflows/tag-version.yml @@ -0,0 +1,51 @@ +name: Tag Version + +on: + workflow_call: + secrets: + # We can't access org secrets here so they need to be passed in. + TAG_VERSION_TOKEN: + required: false + description: > + An authentication token, like a personal access token (PAT), that provides 'Workflow' permission with write access + to the workflow files of the repository and can be used to modify GitHub actions and workflows. This is necessary + because when a pull request is merged while being authenticated with the default GITHUB_TOKEN of a workflow run, + then the merge won't trigger other workflows (like a build workflow on the target branch). This is an intentional limitation, see: + https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow. + Thus, we need to use an alternative authentication token. See + https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token + for info on how to create PATs; you'll need one with the "work" scope. We recommend creating such a token from under a bot user + account only used for such operations, so it's not tied to a natural person. +jobs: + run: + name: Set GitHub Action/Workflow to Version Tag + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev + with: + token: ${{ secrets.TAG_VERSION_TOKEN }} + - name: Determine Version Tag Name from Branch Name + id: determine-tag + shell: pwsh + run: | + $refname = "${{ github.ref_name }}" + $tagname = $refname -replace 'release/', '' + $output = "tagname=$tagname" + Write-Output "output=$output" + $output >> $env:GITHUB_OUTPUT + - name: Set Ref for GitHub Actions and Workflows + uses: Lombiq/GitHub-Actions/.github/actions/set-gha-refs@issue/OSOE-735 + with: + additional-pattern-include-list: '@("https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github")' + expected-ref: '${{ steps.determine-tag.outputs.tagname }}' + - name: Commit and Push Changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: 'Set GitHub Actions/Workflows to tag ${{ steps.determine-tag.outputs.tagname }}' + tagging_message: ${{ steps.determine-tag.outputs.tagname }} + - name: Force Push Tag + continue-on-error: true + shell: pwsh + run: | + git push --tags --force From 859c77da374538d9a4b077824a48185ec24dd6fd Mon Sep 17 00:00:00 2001 From: David Puplava Date: Wed, 14 Feb 2024 09:06:01 -0600 Subject: [PATCH 07/32] Rmove whitespace --- .github/workflows/tag-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 974bd96b2..6535856b0 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -8,7 +8,7 @@ on: required: false description: > An authentication token, like a personal access token (PAT), that provides 'Workflow' permission with write access - to the workflow files of the repository and can be used to modify GitHub actions and workflows. This is necessary + to the workflow files of the repository and can be used to modify GitHub actions and workflows. This is necessary because when a pull request is merged while being authenticated with the default GITHUB_TOKEN of a workflow run, then the merge won't trigger other workflows (like a build workflow on the target branch). This is an intentional limitation, see: https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow. From c5281cc06bdeec12b3a6110bca735a4c94d1b5b4 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Fri, 8 Mar 2024 22:04:20 -0600 Subject: [PATCH 08/32] Update readme to include information on automatic versioning --- Readme.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Readme.md b/Readme.md index cf90c3263..c7e60faee 100644 --- a/Readme.md +++ b/Readme.md @@ -35,3 +35,22 @@ Bug reports, feature requests, comments, questions, code contributions and love This project is developed by [Lombiq Technologies](https://lombiq.com/). Commercial-grade support is available through Lombiq. To ensure that when changing actions or workflows their references to other actions/workflows are up-to-date (i.e. instead of `@dev` they reference each other with `@current-branch`) the [Validate GitHub Actions Refs workflow](https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/workflows/validate-this-gha-refs.yml) will fail if references are incorrect. This is the case also if after a pull request approve that references don't point to the target branch; before merging, that should be fixed, otherwise merging via the merge queue will fail. + +## Versioning, Tags and Releases + +New versions of Lombiq GitHub Actions are automatically tagged using the [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version-this-repo.yml) workflow. This workflow is triggered for release branches named with the following `release/**` pattern (e.g. `release/v1.0`, `release/v2.0-alpha` etc.). + +Follow this process to create a new version: +1. Create a new release branch using the `release/v1.0` convention where `v1.0` is your new version name. +2. Push your `release/v1.0` branch. + +When you push your new release branch, the following things happen automatically: +- The [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version-this-repo.yml) workflow runs and calls the reusable workflow [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version.yml). +- The [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version.yml) workflow calls a reusable action [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml). +- The [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action recursively searches all files in the `.github` folder and subfolders to find each call to a Lombiq GitHub Action or Workflow. +- By default, all called actions and workflows targeting the `@release/v1.0` issue branch (see above) are string replaced with the release name (e.g. `v1.0`). + - Additionally, the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action has parameter [additional-pattern-include-list](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml#L24) which allows for replacing `@release/v1.0` under special circumstances such as for the [spelling action explicit file reference](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/spelling/action.yml#L133) scenario. +- An open source action `stefanzweifel/git-auto-commit-action` is used to automatically: + - Committed the updated files to the `@release/v1.0` branch. + - Create a new git tag using the release name (e.g. `v1.0`). +- A call to git force push tags is made to update the `v1.0` tag if it needs to be updated. From 4ee3af6f7ff65b01825f58cdb72a28f360037465 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Fri, 8 Mar 2024 22:06:08 -0600 Subject: [PATCH 09/32] Line wrap yaml descriptions to 120 characters --- .github/actions/set-gha-refs/action.yml | 20 +++++++++++--------- .github/workflows/tag-version.yml | 13 +++++++------ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/actions/set-gha-refs/action.yml b/.github/actions/set-gha-refs/action.yml index 40b5eb78f..2c88bb534 100644 --- a/.github/actions/set-gha-refs/action.yml +++ b/.github/actions/set-gha-refs/action.yml @@ -7,27 +7,29 @@ inputs: required: false default: '@(".github")' description: > - PowerShell string array of paths, relative to the repository root, to search for GHA files, e.g. '@(".github")' or '@(".github/actions", ".github/workflows")'. The - parameter must be a PowerShell string array. + PowerShell string array of paths, relative to the repository root, to search for GHA files, e.g. '@(".github")' or + '@(".github/actions", ".github/workflows")'. The parameter must be a PowerShell string array. file-include-list: required: false default: '@("*.yml","*.yaml")' description: > - PowerShell string array of file name patterns to include when evaluating GHA files, e.g. '@("*.yml")' or '@("*.yml", "*.yaml")'. The - parameter must be a PowerShell string array. + PowerShell string array of file name patterns to include when evaluating GHA files, e.g. '@("*.yml")' or + '@("*.yml", "*.yaml")'. The parameter must be a PowerShell string array. called-repo-base-include-list: required: false default: '@("${{ github.repository }}")' description: > - PowerShell string array of repository base URLs to include when evaluating called GHA Workflows and Actions, e.g '@("Lombiq/GitHub-Actions")' or - '@("Lombiq/GitHub-Actions", "Lombiq/Open-Source-Orchard-Core-Extensions")'. The parameter must be a PowerShell string array. + PowerShell string array of repository base URLs to include when evaluating called GHA Workflows and Actions, e.g + '@("Lombiq/GitHub-Actions")' or '@("Lombiq/GitHub-Actions", "Lombiq/Open-Source-Orchard-Core-Extensions")'. The + parameter must be a PowerShell string array. additional-pattern-include-list: required: false default: '@()' description: > - PowerShell string array of additional RegEx patterns to include when searching for branch references that need to be - updated, e.g. 'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github/'. The pattern MUST include a regex named capture group (?[aA-zZ,0-9,-,\.,/,_]*) so the captured ref - can be updated correctly. The parameter must be a PowerShell string array. + PowerShell string array of additional RegEx patterns to include when searching for branch references that need to + be updated, e.g. 'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github/'. + The pattern MUST include a regex named capture group (?[aA-zZ,0-9,-,\.,/,_]*) so the captured ref can be + updated correctly. The parameter must be a PowerShell string array. expected-ref: required: true description: The expected reference value to set for all called GHA Workflows and Actions. diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 6535856b0..30a72cea9 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -7,15 +7,16 @@ on: TAG_VERSION_TOKEN: required: false description: > - An authentication token, like a personal access token (PAT), that provides 'Workflow' permission with write access - to the workflow files of the repository and can be used to modify GitHub actions and workflows. This is necessary - because when a pull request is merged while being authenticated with the default GITHUB_TOKEN of a workflow run, - then the merge won't trigger other workflows (like a build workflow on the target branch). This is an intentional limitation, see: + An authentication token, like a personal access token (PAT), that provides 'Workflow' permission with write + access to the workflow files of the repository and can be used to modify GitHub actions and workflows. This is + necessary because when a pull request is merged while being authenticated with the default GITHUB_TOKEN of a + workflow run, then the merge won't trigger other workflows (like a build workflow on the target branch). This + is an intentional limitation, see: https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow. Thus, we need to use an alternative authentication token. See https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token - for info on how to create PATs; you'll need one with the "work" scope. We recommend creating such a token from under a bot user - account only used for such operations, so it's not tied to a natural person. + for info on how to create PATs; you'll need one with the "work" scope. We recommend creating such a token from + under a bot user account only used for such operations, so it's not tied to a natural person. jobs: run: name: Set GitHub Action/Workflow to Version Tag From 66de8664c3c3c71430ef612a3758f5021e3bfd70 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Fri, 8 Mar 2024 22:28:02 -0600 Subject: [PATCH 10/32] Surface the set-gha-refs action parameters up to workflow Add inputs to tag-version workflow to pass to the set-gha-refs action. This is similar to how LGHA's spelling workflow/action is done. This then allows the tag-version-this-repo workflow to customize the additional-pattern-include-list specific to LGHA explicit references. --- .github/workflows/tag-version-this-repo.yml | 2 + .github/workflows/tag-version.yml | 46 ++++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tag-version-this-repo.yml b/.github/workflows/tag-version-this-repo.yml index 29b2bb721..1af4b4c63 100644 --- a/.github/workflows/tag-version-this-repo.yml +++ b/.github/workflows/tag-version-this-repo.yml @@ -9,5 +9,7 @@ jobs: name: Tag Version Automation if: github.event.pusher.name != 'LombiqBot' uses: Lombiq/GitHub-Actions/.github/workflows/tag-version.yml@issue/OSOE-735 + with: + additional-pattern-include-list: '@("https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github")' secrets: TAG_VERSION_TOKEN: ${{ secrets.LOMBIQBOT_GITHUB_PERSONAL_ACCESS_TOKEN }} diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 30a72cea9..5ac169ff1 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -17,6 +17,45 @@ on: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token for info on how to create PATs; you'll need one with the "work" scope. We recommend creating such a token from under a bot user account only used for such operations, so it's not tied to a natural person. + inputs: + path-include-list: + description: > + PowerShell string array of paths, relative to the repository root, to search for GHA files, e.g. + '@(".github")' or '@(".github/actions", ".github/workflows")'. The parameter must be a PowerShell string + array. + required: false + default: '@(".github")' + type: string + file-include-list: + required: false + default: '@("*.yml","*.yaml")' + description: > + PowerShell string array of file name patterns to include when evaluating GHA files, e.g. '@("*.yml")' or + '@("*.yml", "*.yaml")'. The parameter must be a PowerShell string array. + type: string + called-repo-base-include-list: + required: false + default: '@("${{ github.repository }}")' + description: > + PowerShell string array of repository base URLs to include when evaluating called GHA Workflows and Actions, + e.g '@("Lombiq/GitHub-Actions")' or '@("Lombiq/GitHub-Actions", + "Lombiq/Open-Source-Orchard-Core-Extensions")'. The parameter must be a PowerShell string array. + type: string + additional-pattern-include-list: + required: false + default: '@()' + description: > + PowerShell string array of additional RegEx patterns to include when searching for branch references that need + to be updated, e.g. + 'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github/'. The pattern + MUST include a regex named capture group (?[aA-zZ,0-9,-,\.,/,_]*) so the captured ref can be updated + correctly. The parameter must be a PowerShell string array. + type: string + expected-ref: + required: false + default: '${{ github.ref_name }}' + description: The expected reference value to set for all called GHA Workflows and Actions. + type: string jobs: run: name: Set GitHub Action/Workflow to Version Tag @@ -30,7 +69,7 @@ jobs: id: determine-tag shell: pwsh run: | - $refname = "${{ github.ref_name }}" + $refname = "${{ inputs.expected-ref }}" $tagname = $refname -replace 'release/', '' $output = "tagname=$tagname" Write-Output "output=$output" @@ -38,7 +77,10 @@ jobs: - name: Set Ref for GitHub Actions and Workflows uses: Lombiq/GitHub-Actions/.github/actions/set-gha-refs@issue/OSOE-735 with: - additional-pattern-include-list: '@("https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github")' + path-include-list: ${{ inputs.path-include-list }} + file-include-list: ${{ inputs.file-include-list }} + called-repo-base-include-list: ${{ inputs.called-repo-base-include-list }} + additional-pattern-include-list: ${{ inputs.additional-pattern-include-list }} expected-ref: '${{ steps.determine-tag.outputs.tagname }}' - name: Commit and Push Changes uses: stefanzweifel/git-auto-commit-action@v5 From 08bf3cfe296447e0bd20724c722e057003168129 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Fri, 8 Mar 2024 22:36:43 -0600 Subject: [PATCH 11/32] Lock external acation stefanzweifel/git-auto-commit-action to specific commit hash for security reasons --- .github/workflows/tag-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 5ac169ff1..3f10b6d09 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -83,7 +83,7 @@ jobs: additional-pattern-include-list: ${{ inputs.additional-pattern-include-list }} expected-ref: '${{ steps.determine-tag.outputs.tagname }}' - name: Commit and Push Changes - uses: stefanzweifel/git-auto-commit-action@v5 + uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5 with: commit_message: 'Set GitHub Actions/Workflows to tag ${{ steps.determine-tag.outputs.tagname }}' tagging_message: ${{ steps.determine-tag.outputs.tagname }} From eed4713f3d49a78fa55a374339335a28312d6fd5 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Fri, 8 Mar 2024 22:39:58 -0600 Subject: [PATCH 12/32] Add empty lines between steps for readability --- .github/workflows/tag-version.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 3f10b6d09..864da4214 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -65,6 +65,7 @@ jobs: uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev with: token: ${{ secrets.TAG_VERSION_TOKEN }} + - name: Determine Version Tag Name from Branch Name id: determine-tag shell: pwsh @@ -74,6 +75,7 @@ jobs: $output = "tagname=$tagname" Write-Output "output=$output" $output >> $env:GITHUB_OUTPUT + - name: Set Ref for GitHub Actions and Workflows uses: Lombiq/GitHub-Actions/.github/actions/set-gha-refs@issue/OSOE-735 with: @@ -82,11 +84,13 @@ jobs: called-repo-base-include-list: ${{ inputs.called-repo-base-include-list }} additional-pattern-include-list: ${{ inputs.additional-pattern-include-list }} expected-ref: '${{ steps.determine-tag.outputs.tagname }}' + - name: Commit and Push Changes uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5 with: commit_message: 'Set GitHub Actions/Workflows to tag ${{ steps.determine-tag.outputs.tagname }}' tagging_message: ${{ steps.determine-tag.outputs.tagname }} + - name: Force Push Tag continue-on-error: true shell: pwsh From ab3535ec8ed3ab95a470cd74b89666d7331a0903 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Fri, 8 Mar 2024 22:47:19 -0600 Subject: [PATCH 13/32] Use LGHA Set-GitHubOutput script for output --- .github/workflows/tag-version.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 864da4214..6323ecd2f 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -61,6 +61,12 @@ jobs: name: Set GitHub Action/Workflow to Version Tag runs-on: ubuntu-latest steps: + - name: Setup Scripts + shell: pwsh + run: | + "${{ github.action_path }}" >> $Env:GITHUB_PATH + (Resolve-Path "${{ github.action_path }}/../../../Scripts").Path >> $Env:GITHUB_PATH + - name: Checkout Repository uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev with: @@ -72,9 +78,7 @@ jobs: run: | $refname = "${{ inputs.expected-ref }}" $tagname = $refname -replace 'release/', '' - $output = "tagname=$tagname" - Write-Output "output=$output" - $output >> $env:GITHUB_OUTPUT + Set-GitHubOutput -Key 'output' -Value $tagname - name: Set Ref for GitHub Actions and Workflows uses: Lombiq/GitHub-Actions/.github/actions/set-gha-refs@issue/OSOE-735 From 32030b651b4e346f76e338b27ba41fa9c416ff6a Mon Sep 17 00:00:00 2001 From: David Puplava Date: Fri, 8 Mar 2024 23:01:27 -0600 Subject: [PATCH 14/32] Update readme to link to externally used action, add spell check ignore to avoid spelling action run failures --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index c7e60faee..6c2e8b2a0 100644 --- a/Readme.md +++ b/Readme.md @@ -50,7 +50,7 @@ When you push your new release branch, the following things happen automatically - The [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action recursively searches all files in the `.github` folder and subfolders to find each call to a Lombiq GitHub Action or Workflow. - By default, all called actions and workflows targeting the `@release/v1.0` issue branch (see above) are string replaced with the release name (e.g. `v1.0`). - Additionally, the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action has parameter [additional-pattern-include-list](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml#L24) which allows for replacing `@release/v1.0` under special circumstances such as for the [spelling action explicit file reference](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/spelling/action.yml#L133) scenario. -- An open source action `stefanzweifel/git-auto-commit-action` is used to automatically: +- An open source action [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action/commit/8756aa072ef5b4a080af5dc8fef36c5d586e521d) is used to automatically: - Committed the updated files to the `@release/v1.0` branch. - Create a new git tag using the release name (e.g. `v1.0`). - A call to git force push tags is made to update the `v1.0` tag if it needs to be updated. From 68021347deed35e840ec20884edf36085bc1520c Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Mon, 11 Mar 2024 22:12:17 +0100 Subject: [PATCH 15/32] A bit of code styling/simplification --- .github/actions/set-gha-refs/action.yml | 3 ++- .github/workflows/tag-version-this-repo.yml | 1 + .github/workflows/tag-version.yml | 10 +++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/actions/set-gha-refs/action.yml b/.github/actions/set-gha-refs/action.yml index 2c88bb534..e93f9ef1e 100644 --- a/.github/actions/set-gha-refs/action.yml +++ b/.github/actions/set-gha-refs/action.yml @@ -33,8 +33,9 @@ inputs: expected-ref: required: true description: The expected reference value to set for all called GHA Workflows and Actions. + runs: - using: "composite" + using: 'composite' steps: - name: Setup shell: pwsh diff --git a/.github/workflows/tag-version-this-repo.yml b/.github/workflows/tag-version-this-repo.yml index 1af4b4c63..5466512f7 100644 --- a/.github/workflows/tag-version-this-repo.yml +++ b/.github/workflows/tag-version-this-repo.yml @@ -1,4 +1,5 @@ name: Tag Version (this repo) + on: push: branches: diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 6323ecd2f..4d0fe3c74 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -56,13 +56,16 @@ on: default: '${{ github.ref_name }}' description: The expected reference value to set for all called GHA Workflows and Actions. type: string + jobs: run: name: Set GitHub Action/Workflow to Version Tag runs-on: ubuntu-latest + defaults: + run: + shell: pwsh steps: - name: Setup Scripts - shell: pwsh run: | "${{ github.action_path }}" >> $Env:GITHUB_PATH (Resolve-Path "${{ github.action_path }}/../../../Scripts").Path >> $Env:GITHUB_PATH @@ -74,7 +77,6 @@ jobs: - name: Determine Version Tag Name from Branch Name id: determine-tag - shell: pwsh run: | $refname = "${{ inputs.expected-ref }}" $tagname = $refname -replace 'release/', '' @@ -97,6 +99,4 @@ jobs: - name: Force Push Tag continue-on-error: true - shell: pwsh - run: | - git push --tags --force + run: git push --tags --force From f19459c45f23862e6f9ece05126b117b147ddc4b Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Mon, 11 Mar 2024 22:42:32 +0100 Subject: [PATCH 16/32] Updating Readme wording in "Versioning, Tags and Releases" and a bit of formatting --- Readme.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Readme.md b/Readme.md index 6c2e8b2a0..b28f54f9b 100644 --- a/Readme.md +++ b/Readme.md @@ -38,19 +38,18 @@ To ensure that when changing actions or workflows their references to other acti ## Versioning, Tags and Releases -New versions of Lombiq GitHub Actions are automatically tagged using the [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version-this-repo.yml) workflow. This workflow is triggered for release branches named with the following `release/**` pattern (e.g. `release/v1.0`, `release/v2.0-alpha` etc.). +New versions of Lombiq GitHub Actions are automatically tagged using the [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version-this-repo.yml) workflow. This workflow is triggered for release branches with a name that matches the `release/**` pattern (e.g. `release/v1.0`, `release/v2.0-alpha`, etc.). -Follow this process to create a new version: -1. Create a new release branch using the `release/v1.0` convention where `v1.0` is your new version name. -2. Push your `release/v1.0` branch. +The create a new release, create a new branch following the above naming convention at the commit to be released and push it. When you push your new release branch, the following things happen automatically: + - The [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version-this-repo.yml) workflow runs and calls the reusable workflow [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version.yml). -- The [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version.yml) workflow calls a reusable action [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml). -- The [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action recursively searches all files in the `.github` folder and subfolders to find each call to a Lombiq GitHub Action or Workflow. -- By default, all called actions and workflows targeting the `@release/v1.0` issue branch (see above) are string replaced with the release name (e.g. `v1.0`). - - Additionally, the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action has parameter [additional-pattern-include-list](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml#L24) which allows for replacing `@release/v1.0` under special circumstances such as for the [spelling action explicit file reference](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/spelling/action.yml#L133) scenario. -- An open source action [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action/commit/8756aa072ef5b4a080af5dc8fef36c5d586e521d) is used to automatically: - - Committed the updated files to the `@release/v1.0` branch. +- The [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version.yml) workflow calls the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) reusable action. +- The [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action recursively searches all files in the `.github` folder to find each call to a GitHub Action or Workflow contained in this repository. +- By default, references to called actions and workflows targeting the release branch (see above) are string replaced with the version name (e.g. `v1.0`). + - Additionally, the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action has parameter [additional-pattern-include-list](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml#L24) which allows for replacing `release/v1.0` under special circumstances such as for the [spelling action explicit file reference](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/spelling/action.yml#L133) scenario. +- The [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action/commit/8756aa072ef5b4a080af5dc8fef36c5d586e521d) action is used to automatically: + - Commit the updated files to the `release/v1.0` branch. - Create a new git tag using the release name (e.g. `v1.0`). -- A call to git force push tags is made to update the `v1.0` tag if it needs to be updated. +- Tags are force pushed to update the `v1.0` tag if it needs to be updated. From 36bbcefab51d7f5a744a026b06f1a30f685f6bf5 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Wed, 13 Mar 2024 21:17:00 -0500 Subject: [PATCH 17/32] Simplify code, fix small bug with GitHub output key name --- .github/workflows/tag-version.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 4d0fe3c74..2f106c47a 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -78,9 +78,8 @@ jobs: - name: Determine Version Tag Name from Branch Name id: determine-tag run: | - $refname = "${{ inputs.expected-ref }}" - $tagname = $refname -replace 'release/', '' - Set-GitHubOutput -Key 'output' -Value $tagname + $tagname = "${{ inputs.expected-ref }}" -replace 'release/', '' + Set-GitHubOutput -Key 'tagname' -Value $tagname - name: Set Ref for GitHub Actions and Workflows uses: Lombiq/GitHub-Actions/.github/actions/set-gha-refs@issue/OSOE-735 From fd52bc05f579ed49ca6718e19879ed3124566758 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Wed, 13 Mar 2024 21:31:47 -0500 Subject: [PATCH 18/32] Add paragraph about why we version LGHA and add clearer formating for ordered steps --- Readme.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Readme.md b/Readme.md index b28f54f9b..8b4e9d56d 100644 --- a/Readme.md +++ b/Readme.md @@ -38,18 +38,20 @@ To ensure that when changing actions or workflows their references to other acti ## Versioning, Tags and Releases +To release versions of Lombiq GitHub Actions, and allow consumers to reference resusable and composite actions in a versioned way (e.g. `@v1.0`), we employ some automation to do this in a consitent and predictable way. See [issue #284 "Introduce versioning and releases (OSOE-735)"](https://github.com/Lombiq/GitHub-Actions/issues/284) for additional details on why we do this. + New versions of Lombiq GitHub Actions are automatically tagged using the [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version-this-repo.yml) workflow. This workflow is triggered for release branches with a name that matches the `release/**` pattern (e.g. `release/v1.0`, `release/v2.0-alpha`, etc.). The create a new release, create a new branch following the above naming convention at the commit to be released and push it. When you push your new release branch, the following things happen automatically: -- The [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version-this-repo.yml) workflow runs and calls the reusable workflow [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version.yml). -- The [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version.yml) workflow calls the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) reusable action. -- The [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action recursively searches all files in the `.github` folder to find each call to a GitHub Action or Workflow contained in this repository. -- By default, references to called actions and workflows targeting the release branch (see above) are string replaced with the version name (e.g. `v1.0`). - - Additionally, the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action has parameter [additional-pattern-include-list](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml#L24) which allows for replacing `release/v1.0` under special circumstances such as for the [spelling action explicit file reference](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/spelling/action.yml#L133) scenario. -- The [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action/commit/8756aa072ef5b4a080af5dc8fef36c5d586e521d) action is used to automatically: - - Commit the updated files to the `release/v1.0` branch. - - Create a new git tag using the release name (e.g. `v1.0`). -- Tags are force pushed to update the `v1.0` tag if it needs to be updated. +1. The [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version-this-repo.yml) workflow runs and calls the reusable workflow [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version.yml). +2. The [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version.yml) workflow calls the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) reusable action. +3. The [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action recursively searches all files in the `.github` folder to find each call to a GitHub Action or Workflow contained in this repository. +4. By default, references to called actions and workflows targeting the release branch (see above) are string replaced with the version name (e.g. `v1.0`). + - Additionally, the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action has parameter [additional-pattern-include-list](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml#L24) which allows for replacing `release/v1.0` under special circumstances such as for the [spelling action explicit file reference](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/spelling/action.yml#L133) scenario. +5. The [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action/commit/8756aa072ef5b4a080af5dc8fef36c5d586e521d) action is used to automatically: + - Commit the updated files to the `release/v1.0` branch. + - Create a new git tag using the release name (e.g. `v1.0`). +6. Tags are force pushed to update the `v1.0` tag if it needs to be updated. From e0ce7b52744b17f81bbd90f7c60ea9b9afc43547 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Wed, 13 Mar 2024 22:23:19 -0500 Subject: [PATCH 19/32] Refactor external action ncipollo/release-action into internal action to centralize versioning; Update uses elsewhere --- .github/actions/publish-nuget/action.yml | 4 +- .github/actions/release-action/action.yml | 184 ++++++++++++++++++++++ .github/workflows/tag-version.yml | 11 ++ 3 files changed, 196 insertions(+), 3 deletions(-) create mode 100644 .github/actions/release-action/action.yml diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index 7f407231c..dccfbf687 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -212,10 +212,8 @@ runs: path: artifacts retention-days: ${{ inputs.nuget-artifact-retention-days }} - # This is not in its own action because it's all very specific to this NuGet publishing. - name: Create Release - # v1.11.2 - uses: ncipollo/release-action@18eadf9c9b0f226f47f164f5373c6a44f0aae169 + uses: Lombiq/GitHub-Actions/.github/actions/release-action@issue/OSOE-735 # This is to prevent creating releases when pushing tags for issue-specific pre-releases like # v4.3.1-alpha.osoe-86. if: "!contains(steps.setup.outputs.publish-version, '-')" diff --git a/.github/actions/release-action/action.yml b/.github/actions/release-action/action.yml new file mode 100644 index 000000000..118b7bb77 --- /dev/null +++ b/.github/actions/release-action/action.yml @@ -0,0 +1,184 @@ +name: Create Release +description: > + Runs ncipollo/release-action. Exists only to centralize which version of the action we use. Intentionally not + documented in Actions.md since it's only meant for internal use. + +# Copied from https://github.com/ncipollo/release-action/blob/v1.11.2/action.yml. Formatted to wrap long +# descriptions. +inputs: + allowUpdates: + description: > + An optional flag which indicates if we should update a release if it already exists. Defaults to false. + required: false + default: '' + artifactErrorsFailBuild: + description: > + An optional flag which indicates if artifact read or upload errors should fail the build. + required: false + default: '' + artifact: + deprecationMessage: Use 'artifacts' instead. + description: > + An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma + delimited list of paths (or globs). + required: false + default: '' + artifacts: + description: > + An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma + delimited list of paths (or globs). + required: false + default: '' + artifactContentType: + description: 'The content type of the artifact. Defaults to raw' + required: false + default: '' + body: + description: 'An optional body for the release.' + required: false + default: '' + bodyFile: + description: 'An optional body file for the release. This should be the path to the file' + required: false + default: '' + commit: + description: "An optional commit reference. This will be used to create the tag if it does not exist." + required: false + default: '' + discussionCategory: + description: > + When provided this will generate a discussion of the specified category. The category must exist otherwise this + will cause the action to fail. This isn't used with draft releases. + required: false + default: '' + draft: + description: "Optionally marks this release as a draft release. Set to true to enable." + required: false + default: '' + generateReleaseNotes: + description: 'Indicates if release notes should be automatically generated.' + required: false + default: 'false' + name: + description: 'An optional name for the release. If this is omitted the tag will be used.' + required: false + default: '' + omitBody: + description: 'Indicates if the release body should be omitted.' + required: false + default: 'false' + omitBodyDuringUpdate: + description: > + Indicates if the release body should be omitted during updates. The body will still be applied for newly created + releases. This will preserve the existing body during updates. + required: false + default: 'false' + omitDraftDuringUpdate: + description: > + Indicates if the draft flag should be omitted during updates. The draft flag will still be applied for newly + created releases. This will preserve the existing draft state during updates. + required: false + default: 'false' + omitName: + description: 'Indicates if the release name should be omitted.' + required: false + default: 'false' + omitNameDuringUpdate: + description: > + Indicates if the release name should be omitted during updates. The name will still be applied for newly created + releases. This will preserve the existing name during updates. + required: false + default: 'false' + omitPrereleaseDuringUpdate: + description: > + Indicates if the prerelease flag should be omitted during updates. The prerelease flag will still be applied for + newly created releases. This will preserve the existing prerelease state during updates. + required: false + default: 'false' + owner: + description: > + Optionally specify the owner of the repo where the release should be generated. Defaults to current repo's owner. + required: false + default: '' + prerelease: + description: "Optionally marks this release as prerelease. Set to true to enable." + required: false + default: '' + removeArtifacts: + description: 'Indicates if existing release artifacts should be removed, Defaults to false.' + required: false + default: 'false' + replacesArtifacts: + description: "Indicates if existing release artifacts should be replaced. Defaults to true." + required: false + default: 'true' + repo: + description: "Optionally specify the repo where the release should be generated. Defaults to current repo" + required: false + default: '' + skipIfReleaseExists: + description: > + When skipIfReleaseExists is enabled the action will be skipped if a non-draft release already exists for the + provided tag. + required: false + default: 'false' + tag: + description: 'An optional tag for the release. If this is omitted the git ref will be used (if it is a tag).' + required: false + default: '' + token: + description: 'The Github token.' + required: false + default: ${{ github.token }} + updateOnlyUnreleased: + description: > + When allowUpdates is enabled, this will fail the action if the release it is updating is not a draft or a + prerelease. + required: false + default: 'false' +outputs: + id: + description: 'The identifier of the created release.' + value: ${{ steps.create-release.outputs.id }} + html_url: + description: 'The HTML URL of the release.' + value: ${{ steps.create-release.outputs.html_url }} + upload_url: + description: 'The URL for uploading assets to the release.' + value: ${{ steps.create-release.outputs.upload_url }} + +runs: + using: 'composite' + steps: + - name: Create Release + id: create-release + # v1.11.2 + uses: ncipollo/release-action@18eadf9c9b0f226f47f164f5373c6a44f0aae169 + with: + allowUpdates: {{ inputs.allowUpdates }} + artifactErrorsFailBuild: {{ inputs.artifactErrorsFailBuild }} + artifact: {{ inputs.artifact }} + artifacts: {{ inputs.artifacts }} + artifactContentType: {{ inputs.artifactContentType }} + body: {{ inputs.body }} + bodyFile: {{ inputs.bodyFile }} + commit: {{ inputs.commit }} + discussionCategory: {{ inputs.discussionCategory }} + draft: {{ inputs.draft }} + generateReleaseNotes: {{ inputs.generateReleaseNotes }} + name: {{ inputs.name }} + omitBody: {{ inputs.omitBody }} + omitBodyDuringUpdate: {{ inputs.omitBodyDuringUpdate }} + omitDraftDuringUpdate: {{ inputs.omitDraftDuringUpdate }} + omitName: {{ inputs.omitName }} + omitNameDuringUpdate: {{ inputs.omitNameDuringUpdate }} + omitPrereleaseDuringUpdate: {{ inputs.omitPrereleaseDuringUpdate }} + owner: {{ inputs.owner }} + prerelease: {{ inputs.prerelease }} + removeArtifacts: {{ inputs.removeArtifacts }} + replacesArtifacts: {{ inputs.replacesArtifacts }} + repo: {{ inputs.repo }} + skipIfReleaseExists: {{ inputs.skipIfReleaseExists }} + tag: {{ inputs.tag }} + token: {{ inputs.token }} + updateOnlyUnreleased: {{ inputs.updateOnlyUnreleased }} diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 2f106c47a..ef8c9489d 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -99,3 +99,14 @@ jobs: - name: Force Push Tag continue-on-error: true run: git push --tags --force + + - name: Create Release + uses: Lombiq/GitHub-Actions/.github/actions/release-action@issue/OSOE-735 + # This is to prevent creating releases when pushing tags for issue-specific pre-releases like + # v4.3.1-alpha.osoe-86. + if: "!contains(steps.determine-tag.outputs.tagname, '-')" + with: + allowUpdates: true + generateReleaseNotes: true + tag: ${{ steps.determine-tag.outputs.tagname }} + From a10279822444700d58a531353ab3fd6a4a8fb917 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Wed, 13 Mar 2024 22:40:28 -0500 Subject: [PATCH 20/32] Fix spelling errors --- Readme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 8b4e9d56d..83d942b85 100644 --- a/Readme.md +++ b/Readme.md @@ -38,7 +38,9 @@ To ensure that when changing actions or workflows their references to other acti ## Versioning, Tags and Releases -To release versions of Lombiq GitHub Actions, and allow consumers to reference resusable and composite actions in a versioned way (e.g. `@v1.0`), we employ some automation to do this in a consitent and predictable way. See [issue #284 "Introduce versioning and releases (OSOE-735)"](https://github.com/Lombiq/GitHub-Actions/issues/284) for additional details on why we do this. +To release versions of Lombiq GitHub Actions, and allow consumers to reference a specific version of a reusable workflow or composite action (e.g. `@v1.0`), we employ some automation to do this in a consistent and predictable way. +See [issue #284 "Introduce versioning and releases (OSOE-735)"](https://github.com/Lombiq/GitHub-Actions/issues/284) +for additional details on why we do this. New versions of Lombiq GitHub Actions are automatically tagged using the [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version-this-repo.yml) workflow. This workflow is triggered for release branches with a name that matches the `release/**` pattern (e.g. `release/v1.0`, `release/v2.0-alpha`, etc.). From ee310678d57e8651b6f6b4a748b0fc7c2a2b721f Mon Sep 17 00:00:00 2001 From: David Puplava Date: Wed, 13 Mar 2024 22:45:18 -0500 Subject: [PATCH 21/32] Update ref to publish-nuget action which changed in this OSOE-735 --- .github/workflows/publish-nuget.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index 281af3c9f..4a167ab60 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -75,7 +75,7 @@ jobs: dotnet-version: ${{ inputs.dotnet-version }} - name: Publish to NuGet - uses: Lombiq/GitHub-Actions/.github/actions/publish-nuget@dev + uses: Lombiq/GitHub-Actions/.github/actions/publish-nuget@issue/OSOE-735 with: source: ${{ inputs.source }} verbosity: ${{ inputs.verbosity }} From 6fb17de667e42b64da23dd77846a80c1b221f333 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Wed, 13 Mar 2024 22:45:55 -0500 Subject: [PATCH 22/32] Remove trailing spaces to satisfy linting --- .github/actions/release-action/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/release-action/action.yml b/.github/actions/release-action/action.yml index 118b7bb77..86065c14c 100644 --- a/.github/actions/release-action/action.yml +++ b/.github/actions/release-action/action.yml @@ -44,7 +44,7 @@ inputs: commit: description: "An optional commit reference. This will be used to create the tag if it does not exist." required: false - default: '' + default: '' discussionCategory: description: > When provided this will generate a discussion of the specified category. The category must exist otherwise this From 1667cd22bd44b87e7e3d5cab95b6425c82621ffe Mon Sep 17 00:00:00 2001 From: David Puplava Date: Wed, 13 Mar 2024 23:07:04 -0500 Subject: [PATCH 23/32] Fix incorrect GitHub Action expression syntax --- .github/actions/release-action/action.yml | 54 +++++++++++------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/actions/release-action/action.yml b/.github/actions/release-action/action.yml index 86065c14c..aafd65730 100644 --- a/.github/actions/release-action/action.yml +++ b/.github/actions/release-action/action.yml @@ -155,30 +155,30 @@ runs: # v1.11.2 uses: ncipollo/release-action@18eadf9c9b0f226f47f164f5373c6a44f0aae169 with: - allowUpdates: {{ inputs.allowUpdates }} - artifactErrorsFailBuild: {{ inputs.artifactErrorsFailBuild }} - artifact: {{ inputs.artifact }} - artifacts: {{ inputs.artifacts }} - artifactContentType: {{ inputs.artifactContentType }} - body: {{ inputs.body }} - bodyFile: {{ inputs.bodyFile }} - commit: {{ inputs.commit }} - discussionCategory: {{ inputs.discussionCategory }} - draft: {{ inputs.draft }} - generateReleaseNotes: {{ inputs.generateReleaseNotes }} - name: {{ inputs.name }} - omitBody: {{ inputs.omitBody }} - omitBodyDuringUpdate: {{ inputs.omitBodyDuringUpdate }} - omitDraftDuringUpdate: {{ inputs.omitDraftDuringUpdate }} - omitName: {{ inputs.omitName }} - omitNameDuringUpdate: {{ inputs.omitNameDuringUpdate }} - omitPrereleaseDuringUpdate: {{ inputs.omitPrereleaseDuringUpdate }} - owner: {{ inputs.owner }} - prerelease: {{ inputs.prerelease }} - removeArtifacts: {{ inputs.removeArtifacts }} - replacesArtifacts: {{ inputs.replacesArtifacts }} - repo: {{ inputs.repo }} - skipIfReleaseExists: {{ inputs.skipIfReleaseExists }} - tag: {{ inputs.tag }} - token: {{ inputs.token }} - updateOnlyUnreleased: {{ inputs.updateOnlyUnreleased }} + allowUpdates: ${{ inputs.allowUpdates }} + artifactErrorsFailBuild: ${{ inputs.artifactErrorsFailBuild }} + artifact: ${{ inputs.artifact }} + artifacts: ${{ inputs.artifacts }} + artifactContentType: ${{ inputs.artifactContentType }} + body: ${{ inputs.body }} + bodyFile: ${{ inputs.bodyFile }} + commit: ${{ inputs.commit }} + discussionCategory: ${{ inputs.discussionCategory }} + draft: ${{ inputs.draft }} + generateReleaseNotes: ${{ inputs.generateReleaseNotes }} + name: ${{ inputs.name }} + omitBody: ${{ inputs.omitBody }} + omitBodyDuringUpdate: ${{ inputs.omitBodyDuringUpdate }} + omitDraftDuringUpdate: ${{ inputs.omitDraftDuringUpdate }} + omitName: ${{ inputs.omitName }} + omitNameDuringUpdate: ${{ inputs.omitNameDuringUpdate }} + omitPrereleaseDuringUpdate: ${{ inputs.omitPrereleaseDuringUpdate }} + owner: ${{ inputs.owner }} + prerelease: ${{ inputs.prerelease }} + removeArtifacts: ${{ inputs.removeArtifacts }} + replacesArtifacts: ${{ inputs.replacesArtifacts }} + repo: ${{ inputs.repo }} + skipIfReleaseExists: ${{ inputs.skipIfReleaseExists }} + tag: ${{ inputs.tag }} + token: ${{ inputs.token }} + updateOnlyUnreleased: ${{ inputs.updateOnlyUnreleased }} From 6c0127f93fd4c49f7852a7326fa0b9ada89c89de Mon Sep 17 00:00:00 2001 From: David Puplava Date: Wed, 13 Mar 2024 23:24:35 -0500 Subject: [PATCH 24/32] Fix path for setting up scripts --- .github/workflows/tag-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index ef8c9489d..21c2f21c0 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -68,7 +68,7 @@ jobs: - name: Setup Scripts run: | "${{ github.action_path }}" >> $Env:GITHUB_PATH - (Resolve-Path "${{ github.action_path }}/../../../Scripts").Path >> $Env:GITHUB_PATH + (Resolve-Path "${{ github.action_path }}/../../Scripts").Path >> $Env:GITHUB_PATH - name: Checkout Repository uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev From 004e19bc90c8448fb087017c106e928fa5514a3f Mon Sep 17 00:00:00 2001 From: David Puplava Date: Wed, 13 Mar 2024 23:49:25 -0500 Subject: [PATCH 25/32] Ensure repo is checked out before setting up scripts --- .github/workflows/tag-version.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 21c2f21c0..fff677a56 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -65,16 +65,16 @@ jobs: run: shell: pwsh steps: - - name: Setup Scripts - run: | - "${{ github.action_path }}" >> $Env:GITHUB_PATH - (Resolve-Path "${{ github.action_path }}/../../Scripts").Path >> $Env:GITHUB_PATH - name: Checkout Repository uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev with: token: ${{ secrets.TAG_VERSION_TOKEN }} + - name: Setup Scripts + run: | + (Resolve-Path "Scripts").Path >> $Env:GITHUB_PATH + - name: Determine Version Tag Name from Branch Name id: determine-tag run: | From 2b473817761b3ad8cf84db3c87ff47c46c403cdb Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Thu, 14 Mar 2024 13:14:57 +0100 Subject: [PATCH 26/32] A bit of code styling in release-action --- .github/actions/release-action/action.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/actions/release-action/action.yml b/.github/actions/release-action/action.yml index aafd65730..1aeda4ee3 100644 --- a/.github/actions/release-action/action.yml +++ b/.github/actions/release-action/action.yml @@ -42,7 +42,7 @@ inputs: required: false default: '' commit: - description: "An optional commit reference. This will be used to create the tag if it does not exist." + description: 'An optional commit reference. This will be used to create the tag if it does not exist.' required: false default: '' discussionCategory: @@ -52,7 +52,7 @@ inputs: required: false default: '' draft: - description: "Optionally marks this release as a draft release. Set to true to enable." + description: 'Optionally marks this release as a draft release. Set to true to enable.' required: false default: '' generateReleaseNotes: @@ -101,7 +101,7 @@ inputs: required: false default: '' prerelease: - description: "Optionally marks this release as prerelease. Set to true to enable." + description: 'Optionally marks this release as prerelease. Set to true to enable.' required: false default: '' removeArtifacts: @@ -109,11 +109,11 @@ inputs: required: false default: 'false' replacesArtifacts: - description: "Indicates if existing release artifacts should be replaced. Defaults to true." + description: 'Indicates if existing release artifacts should be replaced. Defaults to true.' required: false default: 'true' repo: - description: "Optionally specify the repo where the release should be generated. Defaults to current repo" + description: 'Optionally specify the repo where the release should be generated. Defaults to current repo' required: false default: '' skipIfReleaseExists: @@ -136,6 +136,7 @@ inputs: prerelease. required: false default: 'false' + outputs: id: description: 'The identifier of the created release.' From 12492f322c5c28b205c794543ddbc84bc87feb09 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Thu, 14 Mar 2024 13:16:37 +0100 Subject: [PATCH 27/32] Removing deprecated parameter from release-action --- .github/actions/release-action/action.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/actions/release-action/action.yml b/.github/actions/release-action/action.yml index 1aeda4ee3..495809727 100644 --- a/.github/actions/release-action/action.yml +++ b/.github/actions/release-action/action.yml @@ -16,13 +16,6 @@ inputs: An optional flag which indicates if artifact read or upload errors should fail the build. required: false default: '' - artifact: - deprecationMessage: Use 'artifacts' instead. - description: > - An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma - delimited list of paths (or globs). - required: false - default: '' artifacts: description: > An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma From bbc033ec3f5e17a5ddb67c37427de09c57d14134 Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Thu, 14 Mar 2024 15:06:57 +0100 Subject: [PATCH 28/32] Minor wording improvement --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 83d942b85..b25bfd120 100644 --- a/Readme.md +++ b/Readme.md @@ -52,7 +52,7 @@ When you push your new release branch, the following things happen automatically 2. The [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version.yml) workflow calls the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) reusable action. 3. The [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action recursively searches all files in the `.github` folder to find each call to a GitHub Action or Workflow contained in this repository. 4. By default, references to called actions and workflows targeting the release branch (see above) are string replaced with the version name (e.g. `v1.0`). - - Additionally, the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action has parameter [additional-pattern-include-list](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml#L24) which allows for replacing `release/v1.0` under special circumstances such as for the [spelling action explicit file reference](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/spelling/action.yml#L133) scenario. + - Additionally, the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action has a parameter called [additional-pattern-include-list](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml#L24) which allows for replacing `release/v1.0` under special circumstances such as for the [spelling action explicit file reference](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/spelling/action.yml#L133) scenario. 5. The [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action/commit/8756aa072ef5b4a080af5dc8fef36c5d586e521d) action is used to automatically: - Commit the updated files to the `release/v1.0` branch. - Create a new git tag using the release name (e.g. `v1.0`). From 05a109a0031c0c81942965fcaa86e8511945fff8 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Thu, 14 Mar 2024 23:24:21 -0500 Subject: [PATCH 29/32] Simplify regex for GitHub Action references --- .github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 | 2 +- .github/actions/set-gha-refs/action.yml | 4 ++-- .github/workflows/tag-version-this-repo.yml | 2 +- .github/workflows/tag-version.yml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 b/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 index d2a81eca7..42dee32a1 100644 --- a/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 +++ b/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 @@ -12,7 +12,7 @@ if ($CalledRepoBaseIncludeList.Count -eq 0) } else { - $CalledRepoBaseIncludeList = $CalledRepoBaseIncludeList.ForEach({ 'uses:\s*' + $PSItem + '.*@(?[aA-zZ,0-9,-,\.,/,_]*)' }) + $CalledRepoBaseIncludeList = $CalledRepoBaseIncludeList.ForEach({ 'uses:\s*' + $PSItem + '.*@(?[\w\./-]*)' }) $matchedRefs = Get-ChildItem -Path $PathIncludeList -Include $FileIncludeList -Force -Recurse | Select-String -Pattern $CalledRepoBaseIncludeList diff --git a/.github/actions/set-gha-refs/action.yml b/.github/actions/set-gha-refs/action.yml index e93f9ef1e..d099d6cc7 100644 --- a/.github/actions/set-gha-refs/action.yml +++ b/.github/actions/set-gha-refs/action.yml @@ -27,8 +27,8 @@ inputs: default: '@()' description: > PowerShell string array of additional RegEx patterns to include when searching for branch references that need to - be updated, e.g. 'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github/'. - The pattern MUST include a regex named capture group (?[aA-zZ,0-9,-,\.,/,_]*) so the captured ref can be + be updated, e.g. 'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[\w\./-]*)/.github/'. + The pattern MUST include a regex named capture group (?[\w\./-]*) so the captured ref can be updated correctly. The parameter must be a PowerShell string array. expected-ref: required: true diff --git a/.github/workflows/tag-version-this-repo.yml b/.github/workflows/tag-version-this-repo.yml index 5466512f7..a791d4829 100644 --- a/.github/workflows/tag-version-this-repo.yml +++ b/.github/workflows/tag-version-this-repo.yml @@ -11,6 +11,6 @@ jobs: if: github.event.pusher.name != 'LombiqBot' uses: Lombiq/GitHub-Actions/.github/workflows/tag-version.yml@issue/OSOE-735 with: - additional-pattern-include-list: '@("https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github")' + additional-pattern-include-list: '@("https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[\w\./-]*)/.github")' secrets: TAG_VERSION_TOKEN: ${{ secrets.LOMBIQBOT_GITHUB_PERSONAL_ACCESS_TOKEN }} diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index fff677a56..7ff0107d2 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -47,8 +47,8 @@ on: description: > PowerShell string array of additional RegEx patterns to include when searching for branch references that need to be updated, e.g. - 'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[aA-zZ,0-9,-,\.,/,_]*)/.github/'. The pattern - MUST include a regex named capture group (?[aA-zZ,0-9,-,\.,/,_]*) so the captured ref can be updated + 'https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[\w\./-]*)/.github/'. The pattern + MUST include a regex named capture group (?[\w\./-]*) so the captured ref can be updated correctly. The parameter must be a PowerShell string array. type: string expected-ref: From 4d5e3a86532867fd21c67d7a7d2f2b0eaf6fc904 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Thu, 14 Mar 2024 23:25:19 -0500 Subject: [PATCH 30/32] Fix typo for matched line number --- .github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 b/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 index 42dee32a1..947319464 100644 --- a/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 +++ b/.github/actions/set-gha-refs/Set-Called-GHA-Refs.ps1 @@ -34,7 +34,7 @@ else Write-Output "$oldline => $newline" $filename = $matched.RelativePath($pwd) - $linenumber = $mismatch.LineNumber + $linenumber = $matched.LineNumber $title = "GHA Ref pinned to '$ExpectedRef'" (Get-Content $filename).Replace($oldline, $newline) | Set-Content $filename From 24f5ce672593779dbe565f7f5b41cd2a704802b7 Mon Sep 17 00:00:00 2001 From: David Puplava Date: Thu, 14 Mar 2024 23:29:15 -0500 Subject: [PATCH 31/32] Remove unused inputs copied from external GitHub Action for LGHA centralized wrapper action --- .github/actions/release-action/action.yml | 129 +--------------------- 1 file changed, 1 insertion(+), 128 deletions(-) diff --git a/.github/actions/release-action/action.yml b/.github/actions/release-action/action.yml index 495809727..e1ae16ea2 100644 --- a/.github/actions/release-action/action.yml +++ b/.github/actions/release-action/action.yml @@ -4,131 +4,27 @@ description: > documented in Actions.md since it's only meant for internal use. # Copied from https://github.com/ncipollo/release-action/blob/v1.11.2/action.yml. Formatted to wrap long -# descriptions. +# descriptions. Removed inputs not used by Lombiq GitHub-Actions. inputs: allowUpdates: description: > An optional flag which indicates if we should update a release if it already exists. Defaults to false. required: false default: '' - artifactErrorsFailBuild: - description: > - An optional flag which indicates if artifact read or upload errors should fail the build. - required: false - default: '' artifacts: description: > An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma delimited list of paths (or globs). required: false default: '' - artifactContentType: - description: 'The content type of the artifact. Defaults to raw' - required: false - default: '' - body: - description: 'An optional body for the release.' - required: false - default: '' - bodyFile: - description: 'An optional body file for the release. This should be the path to the file' - required: false - default: '' - commit: - description: 'An optional commit reference. This will be used to create the tag if it does not exist.' - required: false - default: '' - discussionCategory: - description: > - When provided this will generate a discussion of the specified category. The category must exist otherwise this - will cause the action to fail. This isn't used with draft releases. - required: false - default: '' - draft: - description: 'Optionally marks this release as a draft release. Set to true to enable.' - required: false - default: '' generateReleaseNotes: description: 'Indicates if release notes should be automatically generated.' required: false default: 'false' - name: - description: 'An optional name for the release. If this is omitted the tag will be used.' - required: false - default: '' - omitBody: - description: 'Indicates if the release body should be omitted.' - required: false - default: 'false' - omitBodyDuringUpdate: - description: > - Indicates if the release body should be omitted during updates. The body will still be applied for newly created - releases. This will preserve the existing body during updates. - required: false - default: 'false' - omitDraftDuringUpdate: - description: > - Indicates if the draft flag should be omitted during updates. The draft flag will still be applied for newly - created releases. This will preserve the existing draft state during updates. - required: false - default: 'false' - omitName: - description: 'Indicates if the release name should be omitted.' - required: false - default: 'false' - omitNameDuringUpdate: - description: > - Indicates if the release name should be omitted during updates. The name will still be applied for newly created - releases. This will preserve the existing name during updates. - required: false - default: 'false' - omitPrereleaseDuringUpdate: - description: > - Indicates if the prerelease flag should be omitted during updates. The prerelease flag will still be applied for - newly created releases. This will preserve the existing prerelease state during updates. - required: false - default: 'false' - owner: - description: > - Optionally specify the owner of the repo where the release should be generated. Defaults to current repo's owner. - required: false - default: '' - prerelease: - description: 'Optionally marks this release as prerelease. Set to true to enable.' - required: false - default: '' - removeArtifacts: - description: 'Indicates if existing release artifacts should be removed, Defaults to false.' - required: false - default: 'false' - replacesArtifacts: - description: 'Indicates if existing release artifacts should be replaced. Defaults to true.' - required: false - default: 'true' - repo: - description: 'Optionally specify the repo where the release should be generated. Defaults to current repo' - required: false - default: '' - skipIfReleaseExists: - description: > - When skipIfReleaseExists is enabled the action will be skipped if a non-draft release already exists for the - provided tag. - required: false - default: 'false' tag: description: 'An optional tag for the release. If this is omitted the git ref will be used (if it is a tag).' required: false default: '' - token: - description: 'The Github token.' - required: false - default: ${{ github.token }} - updateOnlyUnreleased: - description: > - When allowUpdates is enabled, this will fail the action if the release it is updating is not a draft or a - prerelease. - required: false - default: 'false' outputs: id: @@ -150,29 +46,6 @@ runs: uses: ncipollo/release-action@18eadf9c9b0f226f47f164f5373c6a44f0aae169 with: allowUpdates: ${{ inputs.allowUpdates }} - artifactErrorsFailBuild: ${{ inputs.artifactErrorsFailBuild }} - artifact: ${{ inputs.artifact }} artifacts: ${{ inputs.artifacts }} - artifactContentType: ${{ inputs.artifactContentType }} - body: ${{ inputs.body }} - bodyFile: ${{ inputs.bodyFile }} - commit: ${{ inputs.commit }} - discussionCategory: ${{ inputs.discussionCategory }} - draft: ${{ inputs.draft }} generateReleaseNotes: ${{ inputs.generateReleaseNotes }} - name: ${{ inputs.name }} - omitBody: ${{ inputs.omitBody }} - omitBodyDuringUpdate: ${{ inputs.omitBodyDuringUpdate }} - omitDraftDuringUpdate: ${{ inputs.omitDraftDuringUpdate }} - omitName: ${{ inputs.omitName }} - omitNameDuringUpdate: ${{ inputs.omitNameDuringUpdate }} - omitPrereleaseDuringUpdate: ${{ inputs.omitPrereleaseDuringUpdate }} - owner: ${{ inputs.owner }} - prerelease: ${{ inputs.prerelease }} - removeArtifacts: ${{ inputs.removeArtifacts }} - replacesArtifacts: ${{ inputs.replacesArtifacts }} - repo: ${{ inputs.repo }} - skipIfReleaseExists: ${{ inputs.skipIfReleaseExists }} tag: ${{ inputs.tag }} - token: ${{ inputs.token }} - updateOnlyUnreleased: ${{ inputs.updateOnlyUnreleased }} From a4eaf75a368cd3959d1767ec0474a4735dd69f9a Mon Sep 17 00:00:00 2001 From: Benedek Farkas Date: Thu, 21 Mar 2024 18:50:25 +0100 Subject: [PATCH 32/32] Reverting branch references to dev --- .github/actions/publish-nuget/action.yml | 2 +- .github/workflows/publish-nuget.yml | 2 +- .github/workflows/tag-version-this-repo.yml | 2 +- .github/workflows/tag-version.yml | 4 ++-- Readme.md | 10 +++++----- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index dccfbf687..dd523abfb 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -213,7 +213,7 @@ runs: retention-days: ${{ inputs.nuget-artifact-retention-days }} - name: Create Release - uses: Lombiq/GitHub-Actions/.github/actions/release-action@issue/OSOE-735 + uses: Lombiq/GitHub-Actions/.github/actions/release-action@dev # This is to prevent creating releases when pushing tags for issue-specific pre-releases like # v4.3.1-alpha.osoe-86. if: "!contains(steps.setup.outputs.publish-version, '-')" diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index 4a167ab60..281af3c9f 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -75,7 +75,7 @@ jobs: dotnet-version: ${{ inputs.dotnet-version }} - name: Publish to NuGet - uses: Lombiq/GitHub-Actions/.github/actions/publish-nuget@issue/OSOE-735 + uses: Lombiq/GitHub-Actions/.github/actions/publish-nuget@dev with: source: ${{ inputs.source }} verbosity: ${{ inputs.verbosity }} diff --git a/.github/workflows/tag-version-this-repo.yml b/.github/workflows/tag-version-this-repo.yml index a791d4829..2105aea5d 100644 --- a/.github/workflows/tag-version-this-repo.yml +++ b/.github/workflows/tag-version-this-repo.yml @@ -9,7 +9,7 @@ jobs: run: name: Tag Version Automation if: github.event.pusher.name != 'LombiqBot' - uses: Lombiq/GitHub-Actions/.github/workflows/tag-version.yml@issue/OSOE-735 + uses: Lombiq/GitHub-Actions/.github/workflows/tag-version.yml@dev with: additional-pattern-include-list: '@("https://raw.githubusercontent.com/Lombiq/GitHub-Actions/(?[\w\./-]*)/.github")' secrets: diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 7ff0107d2..42c4e9274 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -82,7 +82,7 @@ jobs: Set-GitHubOutput -Key 'tagname' -Value $tagname - name: Set Ref for GitHub Actions and Workflows - uses: Lombiq/GitHub-Actions/.github/actions/set-gha-refs@issue/OSOE-735 + uses: Lombiq/GitHub-Actions/.github/actions/set-gha-refs@dev with: path-include-list: ${{ inputs.path-include-list }} file-include-list: ${{ inputs.file-include-list }} @@ -101,7 +101,7 @@ jobs: run: git push --tags --force - name: Create Release - uses: Lombiq/GitHub-Actions/.github/actions/release-action@issue/OSOE-735 + uses: Lombiq/GitHub-Actions/.github/actions/release-action@dev # This is to prevent creating releases when pushing tags for issue-specific pre-releases like # v4.3.1-alpha.osoe-86. if: "!contains(steps.determine-tag.outputs.tagname, '-')" diff --git a/Readme.md b/Readme.md index b25bfd120..1a3415e47 100644 --- a/Readme.md +++ b/Readme.md @@ -42,17 +42,17 @@ To release versions of Lombiq GitHub Actions, and allow consumers to reference a See [issue #284 "Introduce versioning and releases (OSOE-735)"](https://github.com/Lombiq/GitHub-Actions/issues/284) for additional details on why we do this. -New versions of Lombiq GitHub Actions are automatically tagged using the [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version-this-repo.yml) workflow. This workflow is triggered for release branches with a name that matches the `release/**` pattern (e.g. `release/v1.0`, `release/v2.0-alpha`, etc.). +New versions of Lombiq GitHub Actions are automatically tagged using the [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/workflows/tag-version-this-repo.yml) workflow. This workflow is triggered for release branches with a name that matches the `release/**` pattern (e.g. `release/v1.0`, `release/v2.0-alpha`, etc.). The create a new release, create a new branch following the above naming convention at the commit to be released and push it. When you push your new release branch, the following things happen automatically: -1. The [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version-this-repo.yml) workflow runs and calls the reusable workflow [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version.yml). -2. The [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/workflows/tag-version.yml) workflow calls the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) reusable action. -3. The [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action recursively searches all files in the `.github` folder to find each call to a GitHub Action or Workflow contained in this repository. +1. The [Tag Version (this repo)](https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/workflows/tag-version-this-repo.yml) workflow runs and calls the reusable workflow [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/workflows/tag-version.yml). +2. The [Tag Version](https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/workflows/tag-version.yml) workflow calls the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/actions/set-gha-refs/action.yml) reusable action. +3. The [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/actions/set-gha-refs/action.yml) action recursively searches all files in the `.github` folder to find each call to a GitHub Action or Workflow contained in this repository. 4. By default, references to called actions and workflows targeting the release branch (see above) are string replaced with the version name (e.g. `v1.0`). - - Additionally, the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml) action has a parameter called [additional-pattern-include-list](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/set-gha-refs/action.yml#L24) which allows for replacing `release/v1.0` under special circumstances such as for the [spelling action explicit file reference](https://github.com/Lombiq/GitHub-Actions/blob/issue/OSOE-735/.github/actions/spelling/action.yml#L133) scenario. + - Additionally, the [Set GitHub Actions References](https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/actions/set-gha-refs/action.yml) action has a parameter called [additional-pattern-include-list](https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/actions/set-gha-refs/action.yml#L24) which allows for replacing `release/v1.0` under special circumstances such as for the [spelling action explicit file reference](https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/actions/spelling/action.yml#L133) scenario. 5. The [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action/commit/8756aa072ef5b4a080af5dc8fef36c5d586e521d) action is used to automatically: - Commit the updated files to the `release/v1.0` branch. - Create a new git tag using the release name (e.g. `v1.0`).