-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.ps1
More file actions
34 lines (28 loc) · 1.44 KB
/
build.ps1
File metadata and controls
34 lines (28 loc) · 1.44 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
Param ($Version = "1.0.0-pre")
$ErrorActionPreference = "Stop"
pushd $PSScriptRoot
# Ensure 0install is in PATH
if (!(Get-Command 0install -ErrorAction SilentlyContinue)) {
$downloadDir = "$env:LOCALAPPDATA\0install.net\bootstrapper"
if (!(Test-Path "$downloadDir\0install.exe")) {
mkdir -Force $downloadDir | Out-Null
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls11,Tls12'
Invoke-WebRequest "https://get.0install.net/0install.exe" -OutFile "$downloadDir\0install.exe"
}
$env:PATH = "$env:PATH;$downloadDir"
}
# Exclude .NET XML Documentation and Debug Symbols from release
rm -Force ..\artifacts\Release\*.xml,..\artifacts\Release\*.pdb
# Inspect version number
$stability = if($Version.Contains("-")) {"developer"} else {"stable"}
# Build feed and archive
cmd /c "0install run --batch http://0install.net/tools/0template.xml LightTag.xml.template version=$Version stability=$stability 2>&1" # Redirect stderr to stdout
if ($LASTEXITCODE -ne 0) {throw "Exit Code: $LASTEXITCODE"}
# Patch archive URL to point to GitHub Release
if ($stability -eq "stable") {
$path = Resolve-Path "LightTag-$Version.xml"
[xml]$xml = Get-Content $path
$xml.interface.group.implementation.archive.href = "https://github.com/nano-byte/LightTag/releases/download/$Version/$($xml.interface.group.implementation.archive.href)"
$xml.Save($path)
}
popd