-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
194 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
version: 1.7.5.{build} | ||
pull_requests: | ||
do_not_increment_build_number: true | ||
branches: | ||
only: | ||
- master | ||
image: Visual Studio 2017 | ||
shallow_clone: true | ||
install: | ||
- ps: Invoke-Expression "./bootstrap.ps1" | ||
build_script: | ||
- ps: >- | ||
$dev = ($Env:APPVEYOR_REPO_TAG -ne "true") | ||
./build-scripts/full.ps1 -version $Env:APPVEYOR_BUILD_VERSION -dev $dev | ||
if (!$dev) { | ||
Copy-Item ./builds/*/* . | ||
} | ||
test: | ||
categories: | ||
except: | ||
- Web | ||
artifacts: | ||
- path: dev-builds/*/* | ||
name: dev | ||
- path: builds/*/HDT-Installer.exe | ||
name: prod-squirrel | ||
- path: builds/*/*.nupkg | ||
name: prod-squirrel | ||
- path: builds/*/RELEASES | ||
name: prod-squirrel | ||
- path: builds/*/Hearthstone.Deck.Tracker-*.zip | ||
name: prod-portable | ||
- path: HDT-Installer.exe | ||
name: prod-asia | ||
- path: '*.nupkg' | ||
name: prod-asia | ||
- path: RELEASES | ||
name: prod-asia | ||
- path: Hearthstone.Deck.Tracker-*.zip | ||
name: prod-asia | ||
deploy: off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
Param( | ||
[Parameter(Mandatory=$True)] | ||
[string]$version, | ||
[boolean]$dev = $true | ||
) | ||
|
||
$initialLocation = $(Get-Location).Path | ||
|
||
$DEV_LATEST = "https://api.github.com/repos/HearthSim/HDT-dev-builds/releases/latest" | ||
$PROD_LATEST = "https://api.github.com/repos/HearthSim/HDT-Releases/releases/latest" | ||
|
||
$baseDir = $(Resolve-Path "$PSScriptRoot\..").Path | ||
$assemblyInfoFile = "$baseDir\Hearthstone Deck Tracker\Properties\AssemblyInfo.cs" | ||
$buildDir = "$baseDir\Hearthstone Deck Tracker\bin\x86" | ||
$hdtReleaseDir = "$buildDir\Hearthstone Deck Tracker" | ||
$squirrelTools = "$baseDir\packages\squirrel.windows.1.7.8\tools" | ||
$signtool = "$squirrelTools\signtool.exe" | ||
$squirrel = "$squirrelTools\Squirrel.exe" | ||
$cert = "$baseDir\cert.pfx" | ||
|
||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | ||
|
||
|
||
# Construct package version | ||
$parts = $version.Split(".") | ||
$major = $parts[0] | ||
$minor = $parts[1] | ||
$patch = $parts[2] | ||
$build = $parts[3] | ||
if ($dev) { | ||
$patch = [int]$patch + 1 | ||
} | ||
$packageVersion = "$major.$minor.$patch" | ||
if ($dev) { | ||
$packageVersion = "$packageVersion-dev$build" | ||
} | ||
|
||
# Update AssemblyInfo.cs with the new version | ||
$assemblyInfo = [IO.File]::ReadAllText($assemblyInfoFile) | ||
$versionRegex = New-Object System.Text.RegularExpressions.Regex ('Version\(\"[\d\.]*"\)') | ||
$assemblyInfo = $versionRegex.Replace($assemblyInfo, 'Version("' + "$major.$minor.$patch.$build" + '")') | ||
[IO.File]::WriteAllText($assemblyInfoFile, $assemblyInfo) | ||
|
||
# Build | ||
if ($dev) { | ||
msbuild "$baseDir\Hearthstone Deck Tracker.sln" /p:Configuration=Debug /p:Platform="x86" /p:DefineConstants='"DEBUG;DEV;SQUIRREL;TRACE"' /p:OutputPath="bin\x86\Squirrel\" | ||
} | ||
else { | ||
msbuild "$baseDir\Hearthstone Deck Tracker.sln" /p:Configuration=Release /p:Platform="x86" | ||
Set-Location "$buildDir\Release" | ||
.$PSScriptRoot/release_post_build.bat | ||
Set-Location $PSScriptRoot | ||
|
||
msbuild "$baseDir\Hearthstone Deck Tracker.sln" /p:Configuration=Squirrel /p:Platform="x86" | ||
} | ||
Set-Location "$buildDir/Squirrel" | ||
.$PSScriptRoot/squirrel_post_build.bat | ||
Set-Location $PSScriptRoot | ||
|
||
# Set up output directory | ||
$buildsDir = if ($dev) { "dev-builds" } else { "builds" }; | ||
$output = "$baseDir\$buildsDir\$packageVersion" | ||
if (!(Test-Path $output)) { | ||
mkdir $output | ||
} | ||
|
||
# Generate cert from environment | ||
if (!(Test-Path "$cert")) { | ||
[IO.File]::WriteAllBytes("$cert", [Convert]::FromBase64String($Env:CERT)) | ||
} | ||
|
||
# Sign and zip up portable build | ||
if (!$dev) { | ||
& $signtool sign /tr "http://timestamp.digicert.com" /a /f $cert /p $Env:CERT_PASSWORD "$hdtReleaseDir\HDTUpdate.exe" "$hdtReleaseDir\HDTUninstaller.exe" "$hdtReleaseDir\Hearthstone Deck Tracker.exe" | Out-Default | ||
Set-Location $buildDir | ||
7z a -r -mx9 "$output\Hearthstone.Deck.Tracker-v$packageVersion.zip" "Hearthstone Deck Tracker" | ||
} | ||
|
||
# Create squirrel build | ||
$url = if ($dev) { $DEV_LATEST } else { $PROD_LATEST } | ||
$json = (Invoke-WebRequest $url).Content | ConvertFrom-Json | ||
$wc = New-Object System.Net.WebClient | ||
$oldFullPkg = $null | ||
foreach ($asset in $json.assets) { | ||
if ($asset.name -eq "HDT-Installer.exe") { | ||
continue | ||
} | ||
"Downloading $($asset.name)..." | ||
$file = "$output\$($asset.name)" | ||
$wc.DownloadFile($asset.browser_download_url, $file) | ||
if ($asset.name.endswith("-full.nupkg")) { | ||
$oldFullPkg = $file | ||
} | ||
} | ||
nuget pack "$PSScriptRoot\hdt.nuspec" -Version $packageVersion -Properties Configuration=Release -OutputDirectory "$buildDir\SquirrelNu" | ||
$icon = "$buildDir\Squirrel\Images\HearthstoneDeckTracker.ico" | ||
$nupkg = "$buildDir\SquirrelNu\HearthstoneDeckTracker.$packageVersion.nupkg" | ||
$certInfo = "/tr http://timestamp.digicert.com /a /f $cert /p $Env:CERT_PASSWORD" | ||
& $squirrel --releasify $nupkg --releaseDir=$output --setupIcon=$icon --icon=$icon --no-msi -n $certInfo | Out-Default | ||
& $signtool sign /tr "http://timestamp.digicert.com" /a /f $cert /p $Env:CERT_PASSWORD "$output\Setup.exe" | Out-Default | ||
Move-Item "$output\Setup.exe" "$output\HDT-Installer.exe" | ||
|
||
# Cleanup | ||
Remove-Item $oldFullPkg | ||
Set-Location $initialLocation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||
<metadata> | ||
<id>HearthstoneDeckTracker</id> | ||
<!-- version will be replaced by MSBuild --> | ||
<version>0.0.0.0</version> | ||
<title>Hearthstone Deck Tracker</title> | ||
<authors>HearthSim</authors> | ||
<description>Hearthstone Deck Tracker</description> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<copyright>Copyright 2018 HearthSim</copyright> | ||
<dependencies /> | ||
</metadata> | ||
<files> | ||
<file src="..\Hearthstone Deck Tracker\bin\x86\Squirrel-Clean\*.*" target="lib\net45\" /> | ||
<file src="..\Hearthstone Deck Tracker\bin\x86\Squirrel-Clean\**\*.*" target="lib\net45\" /> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
rmdir /S /Q "..\Hearthstone Deck Tracker" | ||
mkdir "..\Hearthstone Deck Tracker" | ||
mkdir "..\Hearthstone Deck Tracker/Images" | ||
xcopy /E /Y /Q "Images\*.*" "..\Hearthstone Deck Tracker\Images" | ||
for /D %%a in (*-*) do ( | ||
mkdir "..\Hearthstone Deck Tracker\%%a" | ||
xcopy "%%a\*.*" "..\Hearthstone Deck Tracker\%%a" | ||
) | ||
xcopy /Y "HearthstoneDeckTracker.exe" "..\Hearthstone Deck Tracker" | ||
xcopy /Y "HearthstoneDeckTracker.exe.config" "..\Hearthstone Deck Tracker" | ||
ren "..\Hearthstone Deck Tracker\HearthstoneDeckTracker.exe" "Hearthstone Deck Tracker.exe" | ||
ren "..\Hearthstone Deck Tracker\HearthstoneDeckTracker.exe.config" "Hearthstone Deck Tracker.exe.config" | ||
xcopy /Y "*.dll" "..\Hearthstone Deck Tracker" | ||
xcopy /Y "..\..\..\..\HDTUpdate\bin\x86\Release\HDTUpdate.exe" "..\Hearthstone Deck Tracker" | ||
xcopy /Y "..\..\..\..\HDTUninstaller\bin\x86\Release\HDTUninstaller.exe" "..\Hearthstone Deck Tracker" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
rmdir /S /Q "..\Squirrel-Clean" | ||
mkdir "..\SquirrelNu" | ||
mkdir "..\Squirrel-Clean" | ||
mkdir "..\Squirrel-Clean/Images" | ||
xcopy /E /Y /Q "Images\*.*" "..\Squirrel-Clean\Images" | ||
for /D %%a in (*-*) do ( | ||
mkdir "..\Squirrel-Clean\%%a" | ||
xcopy "%%a\*.*" "..\Squirrel-Clean\%%a" | ||
) | ||
xcopy /Y "HearthstoneDeckTracker.exe" "..\Squirrel-Clean" | ||
xcopy /Y "HearthstoneDeckTracker.exe.config" "..\Squirrel-Clean" | ||
xcopy /Y "*.dll" "..\Squirrel-Clean" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters