Skip to content

Commit ecf85cb

Browse files
committed
Distribute scripts
1 parent d05e55d commit ecf85cb

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

psm.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ cleanAll: Remove-Item -Recurse ./Publish/; Remove-Item -Recurse ./build/
66
fresh: psm configure; psm build
77
copy: Copy-Item ".\build\x64\magickmeter.dll" "$env:APPDATA\Rainmeter\Plugins"
88
killrm: Stop-Process -name rainmeter
9+
# Specify 3 parameters `major minor patch`. Example: psm bump 1 5 0
10+
bump: . ./task.ps1; bumpVersion
11+
dist: . ./task.ps1; dist

task.ps1

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,32 @@ function build() {
1717
#Build x86
1818
&$msbuild /p:Platform=Win32
1919
}
20+
21+
function dist() {
22+
$version = "0.5.0"
23+
Get-ChildItem -Recurse -File -Path ".\build" |
24+
Where-Object {$_.Extension -notmatch ".dll" } |
25+
Foreach-Object { Remove-Item $_.FullName }
26+
27+
Compress-Archive -Path ".\build\*" ".\build\magickmeter-$($version)-dll-x64-x86.zip"
28+
}
29+
30+
function bumpVersion() {
31+
param (
32+
[Parameter(Mandatory = $true)][int16]$major,
33+
[Parameter(Mandatory = $true)][int16]$minor,
34+
[Parameter(Mandatory = $true)][int16]$patch
35+
)
36+
37+
$ver = "$($major).$($minor).$($patch)"
38+
39+
(Get-Content ".\src\version.h") -replace "PLUGIN_VERSION `"[\d\.]*`"", "PLUGIN_VERSION `"$($ver).0`"" |
40+
Set-Content ".\src\version.h"
41+
42+
(Get-Content ".\task.ps1") -replace "version = `"[\d\.]*`"", "version = `"$($ver)`"" |
43+
Set-Content ".\task.ps1"
44+
45+
$ver2 = "$($major),$($minor),$($patch)"
46+
(Get-Content ".\src\Magickmeter.rc") -replace "FILEVERSION [\d,]*", "FILEVERSION $($ver2),0" |
47+
Set-Content ".\src\Magickmeter.rc"
48+
}

0 commit comments

Comments
 (0)