test other action #47
Workflow file for this run
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
name: 'Update Version' | |
on: | |
push: | |
tags: [ '[0-9]+.[0-9]+.[0-9]+-?**' ] | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: | | |
pwsh -noninteractive -command "try {{ $ErrorActionPreference='Stop'; . '{0}' }} catch {{ Write-Error ""FAILED: $_""; throw; }} if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) {{ exit $LASTEXITCODE }}" | |
jobs: | |
# This job is required because C# is assholes and dotnet publish refuses to use the version number set by the SetVersion.ps1 script. | |
update-version-number: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: 'main' | |
fetch-depth: 0 | |
- name: Update .csproj Version Numbers | |
run: | | |
$tag = $(git describe --tags --abbrev=0) | |
$tag -cmatch '(?<MAJOR>\d+?)\.(?<MINOR>\d+?)\.(?<PATCH>\d+?)(?<EXTRA>.*)' > $null | |
$tag_3_part = $Matches.MAJOR + '.' + $Matches.MINOR + '.' + $Matches.PATCH | |
$copyright = "Copyright © 2022-$((Get-Date).Year) by `$`(Authors`)" | |
.\SetVersion.ps1 -Path VolumeControl.Log/VolumeControl.Log.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright | |
.\SetVersion.ps1 -Path VolumeControl.TypeExtensions/VolumeControl.TypeExtensions.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright | |
.\SetVersion.ps1 -Path VolumeControl.WPF/VolumeControl.WPF.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright | |
.\SetVersion.ps1 -Path VolumeControl.HotkeyActions/VolumeControl.HotkeyActions.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright | |
.\SetVersion.ps1 -Path VolumeControl.CoreAudio/VolumeControl.CoreAudio.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright | |
.\SetVersion.ps1 -Path VolumeControl.Core/VolumeControl.Core.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright | |
.\SetVersion.ps1 -Path VolumeControl.SDK/VolumeControl.SDK.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright | |
.\SetVersion.ps1 -Path VolumeControl/VolumeControl.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright | |
- name: Push Changes | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add -A | |
git commit -m "Update .csproj Version Numbers" | |
git push origin | |
# HEAD:github-actions |