forked from Reloaded-Project/Reloaded-II
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Publish.Reloaded.Release.ps1
59 lines (47 loc) · 2.57 KB
/
Publish.Reloaded.Release.ps1
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<#
.SYNOPSIS
Creates Packages for a Release of Reloaded-II#
.PARAMETER Version
Current version of Reloaded-II.
.PARAMETER CurrentVersionPath
Path to current version on Disk.
.PARAMETER ReleasePath
Where to save the release for upload.
.PARAMETER NumberOfDeltaReleases
The number of delta releases to create.
#>
[cmdletbinding()]
param (
## => User Config <= ##
$Version = "1.0.0",
$CurrentVersionPath = "./CurrentVersion",
$ReleasePath = "./Publish/Release",
$NumberOfDeltaReleases = 3
)
$PackagesPath = "./Publish/Packages"
$IgnoreRegexesPath = "./Publish-Settings/Ignore-Regexes.txt"
$IncludeRegexesPath = "./Publish-Settings/Include-Regexes.txt"
$PackagesListBasePath = "./Publish-Settings/Packages.txt"
$PackagesListPath = "$PackagesPath/Packages.txt"
Remove-Item "$PackagesPath" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$ReleasePath" -Recurse -Force -ErrorAction SilentlyContinue
New-Item "$PackagesPath" -ItemType Directory -ErrorAction SilentlyContinue
Copy-Item -Path "$PackagesListBasePath" -Destination "$PackagesListPath"
## Download Update Tool
if (-Not (Test-Path -Path 'Sewer56.Update.Tool')) {
Invoke-WebRequest -Uri "https://github.com/Sewer56/Update/releases/latest/download/Sewer56.Update.Tool.zip" -OutFile "Sewer56.Update.Tool.zip"
## Extract Tools
Expand-Archive -LiteralPath './Sewer56.Update.Tool.zip' -DestinationPath "Sewer56.Update.Tool"
Remove-Item './Sewer56.Update.Tool.zip' -Recurse -Force
}
## Generate Package
Write-Host "Creating Current Version Package"
$toolPath = "./Sewer56.Update.Tool/Sewer56.Update.Tool.dll"
dotnet $toolPath CreateCopyPackage --folderpath "$CurrentVersionPath" --version "$Version" --outputpath "$PackagesPath/current-version-package" --ignoreregexespath "$IgnoreRegexesPath" --includeregexespath "$IncludeRegexesPath"
## Uncomment for 2nd update and above
Write-Host "Creating Deltas"
dotnet $toolPath AutoCreateDelta --outputpath "$PackagesPath" --source GitHub --folderpath "$CurrentVersionPath" --version "$Version" --githubusername "Reloaded-Project" --githubrepositoryname "Reloaded-II" --githublegacyfallbackpattern "Release.zip" --numreleases $NumberOfDeltaReleases --ignoreregexespath "$IgnoreRegexesPath" --includeregexespath "$IncludeRegexesPath" --noprogressbar | Out-File -FilePath "$PackagesListPath" -Encoding utf8 -Append
## Create Release
Write-Host "Creating Release"
dotnet $toolPath CreateRelease --existingpackagespath "$PackagesListPath" --outputpath "$ReleasePath" --packagename "Release" --dontappendversiontopackages
Remove-Item "$PackagesPath" -Recurse -Force