-
Notifications
You must be signed in to change notification settings - Fork 8
48 lines (40 loc) · 2.87 KB
/
UpdateVersion.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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`)"
.\.github\workflows\scripts\SetProperty.ps1 -Path VolumeControl.Log/VolumeControl.Log.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright
.\.github\workflows\scripts\SetProperty.ps1 -Path VolumeControl.TypeExtensions/VolumeControl.TypeExtensions.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright
.\.github\workflows\scripts\SetProperty.ps1 -Path VolumeControl.WPF/VolumeControl.WPF.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright
.\.github\workflows\scripts\SetProperty.ps1 -Path VolumeControl.HotkeyActions/VolumeControl.HotkeyActions.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright
.\.github\workflows\scripts\SetProperty.ps1 -Path VolumeControl.CoreAudio/VolumeControl.CoreAudio.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright
.\.github\workflows\scripts\SetProperty.ps1 -Path VolumeControl.Core/VolumeControl.Core.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright
.\.github\workflows\scripts\SetProperty.ps1 -Path VolumeControl.SDK/VolumeControl.SDK.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright
.\.github\workflows\scripts\SetProperty.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