-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add example workflow that updates to latest version the tasks/actions
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Update examples version | ||
|
||
on: | ||
repository_dispatch: | ||
types: [ update-examples ] | ||
|
||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
jobs: | ||
update-examples-version: | ||
if: ${{ github.event_name == 'repository_dispatch' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.PUSH_GITHUB_TOKEN }} | ||
- run: | | ||
$oldTag = "${{ github.event.client_payload.oldTag }}" | ||
$newTag = "${{ github.event.client_payload.newTag }}" | ||
. .\update-version.ps1 # Import the functions | ||
dir -r .github\**\*.yml | % { update-md-files $_ -OldVersion $oldTag -NewVersion $newTag } | ||
dir -r .azure\**\*.yml | % { update-md-files $_ -OldVersion $oldTag -NewVersion $newTag } | ||
git add --verbose . | ||
git config user.name 'Artur Stolear' | ||
git config user.email 'artur.stolear@gmail.com' | ||
git commit -m "update examples version to $newTag" --allow-empty | ||
git push --force | ||
name: Update examples version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
function update-md-files() | ||
{ | ||
param( | ||
[Parameter(Mandatory = $True, Position = 0, ValueFromPipeline = $true)] | ||
[System.String] | ||
$file, | ||
|
||
[Parameter(Mandatory = $True, Position = 1, ValueFromPipeline = $false)] | ||
[System.String] | ||
$oldVersion, | ||
|
||
[Parameter(Mandatory = $True, Position = 2, ValueFromPipeline = $false)] | ||
[System.String] | ||
$newVersion | ||
) | ||
$file = Resolve-Path $file | ||
Write-Host "Update md file $file version from $oldVersion to $newVersion" | ||
|
||
((Get-Content $file -Raw) -replace $oldVersion, $newVersion) | Set-Content $file -NoNewline | ||
} |