-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (26 loc) · 1.18 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
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@v3
with:
ref: 'main'
fetch-depth: 0
- name: Update Version Numbers and Push Changes
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 © $((Get-Date).Year) by `$`(Authors`)"
.\SetVersion.ps1 -Path XamlTimers.csproj Version=$tag FileVersion=$tag_3_part Copyright=$copyright
# HEAD:github-actions