-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.ps1
More file actions
40 lines (33 loc) · 1.73 KB
/
Copy pathpublish.ps1
File metadata and controls
40 lines (33 loc) · 1.73 KB
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
$ErrorActionPreference = 'Stop'
# Ensure version number on command line
if([String]::IsNullOrEmpty($Args[0])) { Write-Host "Version is required"; exit 1; }
$version = $Args[0];
# Update csproj version number
# Trim starting v --> v0.9.9 --> 0.9.9 because csproj version must be specific x.y.m.n format
$versionNum = $version.TrimStart('v')
$projPath = get-item "src\RollingBackupSweep.csproj"
$csproj = [xml] (get-content $projPath)
$csproj.Project.PropertyGroup.Version = $versionNum
$csProj.Save($projPath)
# Ensure git committed (we will tag and push on release)
# Do after modifying csproj version to catch that update
$changes = $(git status --porcelain)
if(![String]::IsNullOrEmpty($changes)) { Write-Host "Uncommitted changes in git"; exit 1; }
# Invoke the linux build - cwd is transformed by wsl.exe and passes through
wsl -- ./publish.sh $version
# Build windows assets & zip
dotnet publish src -r win-x64 -c Release -o publish &&
compress-archive -path .\publish\RollingBackupSweep.exe -destinationpath .\publish\RollingBackupSweep-${version}-win-x64.zip
dotnet publish src -r win-arm64 -c Release -o publish &&
compress-archive -path .\publish\RollingBackupSweep.exe -destinationpath .\publish\RollingBackupSweep-${version}-win-arm64.zip
# Create release & upload
$yesno = Read-Host -Prompt "Tag git, push all, push tags; create ${version} at github and upload? [Y/N]"
if ($yesno -ieq 'y') {
git tag $version --force
git push --all
git push --tags --force
gh release create $version
pushd publish
gh release upload $version RollingBackupSweep-${version}-linux-arm64.tar.gz RollingBackupSweep-${version}-linux-x64.tar.gz RollingBackupSweep-${version}-win-arm64.zip RollingBackupSweep-${version}-win-x64.zip
popd
}