2020-06-01 22:15:42 +00:00
|
|
|
function Get-Changelog($lastTag)
|
2018-12-28 23:11:21 +00:00
|
|
|
{
|
2020-06-01 22:15:42 +00:00
|
|
|
if(!$lastTag)
|
|
|
|
{
|
|
|
|
$lastTag = git describe --tags --abbrev=0
|
|
|
|
}
|
|
|
|
|
2017-06-09 16:47:50 +00:00
|
|
|
$tag = "$lastTag..HEAD"
|
|
|
|
|
2020-07-30 10:06:38 +00:00
|
|
|
$clArr = (git log $tag --oneline)
|
2017-06-10 21:52:44 +00:00
|
|
|
[array]::Reverse($clArr)
|
2017-06-09 23:12:54 +00:00
|
|
|
$changelog = $clArr | where { "$_" -notlike "*(POEditor.com)*" -and "$_" -notlike "*Merge branch*" -and "$_" -notlike "*Merge pull request*" -and "$_" -notlike "^-*" -and "$_" -notlike "*Merge remote tracking*" }
|
|
|
|
$changelog = [string]::join([Environment]::NewLine, $changelog)
|
2017-06-09 16:47:50 +00:00
|
|
|
|
2017-06-09 23:12:54 +00:00
|
|
|
$cl2 = $clArr | where { "$_" -like "*Merge pull request*" }
|
2017-06-11 00:26:19 +00:00
|
|
|
$changelog = "## Changes$nl$changelog"
|
2018-12-28 23:11:21 +00:00
|
|
|
if ($null -ne $cl2) {
|
2018-03-04 08:04:39 +00:00
|
|
|
$cl2 = [string]::join([Environment]::NewLine, $cl2)
|
|
|
|
$changelog = $changelog + "$nl ## Pull Requests Merged$nl$cl2"
|
2017-06-11 00:26:19 +00:00
|
|
|
}
|
2020-07-30 10:06:38 +00:00
|
|
|
|
|
|
|
return $changelog
|
2018-12-28 23:11:21 +00:00
|
|
|
}
|
|
|
|
|
2019-04-03 01:11:14 +00:00
|
|
|
function Build-Installer($versionNumber)
|
|
|
|
{
|
|
|
|
$env:NADEKOBOT_INSTALL_VERSION = $versionNumber
|
|
|
|
|
2019-09-21 19:09:43 +00:00
|
|
|
dotnet clean
|
2020-06-01 22:15:42 +00:00
|
|
|
# rm -r -fo "src\NadekoBot\bin"
|
2020-07-06 07:50:56 +00:00
|
|
|
dotnet publish -c Release --runtime win7-x64 /p:Version=$versionNumber
|
2021-05-09 17:06:03 +00:00
|
|
|
# .\rcedit-x64.exe "src\NadekoBot\bin\Release\netcoreapp2.1\win7-x64\nadekobot.exe" --set-icon "src\NadekoBot\bin\Release\netcoreapp2.1\win7-x64\nadeko_icon.ico"
|
2019-04-03 01:11:14 +00:00
|
|
|
|
2020-07-06 07:50:56 +00:00
|
|
|
& "iscc.exe" "/O+" ".\exe_builder.iss"
|
2019-04-03 01:11:14 +00:00
|
|
|
|
2020-07-30 10:06:38 +00:00
|
|
|
Write-ReleaseFile($versionNumber)
|
2020-07-06 07:50:56 +00:00
|
|
|
# $path = [Environment]::GetFolderPath('MyDocuments') + "\_projekti\new_installer\$versionNumber\";
|
|
|
|
# $binPath = $path + "nadeko-setup-$versionNumber.exe";
|
|
|
|
# Copy-Item -Path $path -Destination $dest -Force -ErrorAction Stop
|
2019-04-03 01:11:14 +00:00
|
|
|
|
2020-07-06 07:50:56 +00:00
|
|
|
# return $path
|
2019-09-21 13:15:20 +00:00
|
|
|
}
|
2018-12-28 23:11:21 +00:00
|
|
|
|
2020-06-01 22:15:42 +00:00
|
|
|
function Write-ReleaseFile($versionNumber) {
|
|
|
|
$changelog = ""
|
2019-09-21 13:15:20 +00:00
|
|
|
# pull the changes if they exist
|
2020-06-01 22:15:42 +00:00
|
|
|
# git pull
|
2019-09-21 13:15:20 +00:00
|
|
|
# attempt to build teh installer
|
2020-06-01 22:15:42 +00:00
|
|
|
# $path = Build-Installer $versionNumber
|
2018-12-28 23:11:21 +00:00
|
|
|
|
2019-09-21 13:15:20 +00:00
|
|
|
# get changelog before tagging
|
2020-07-30 10:06:38 +00:00
|
|
|
$changelog = Get-Changelog
|
2019-09-21 13:15:20 +00:00
|
|
|
# tag the release
|
2019-09-28 06:45:56 +00:00
|
|
|
# & (git tag, $tag)
|
2017-06-09 23:12:54 +00:00
|
|
|
|
2019-09-21 13:15:20 +00:00
|
|
|
# print out the changelog to the console
|
2020-06-01 22:15:42 +00:00
|
|
|
# Write-Host $changelog
|
2017-06-11 00:26:19 +00:00
|
|
|
|
2020-10-30 02:45:53 +00:00
|
|
|
$jsonReleaseFile = "[{""VersionName"": ""$versionNumber"", ""DownloadLink"": ""https://cdn.nadeko.bot/dl/bot/nadeko-setup-$versionNumber.exe"", ""Changelog"": """"}]"
|
2017-06-09 16:47:50 +00:00
|
|
|
|
2020-07-30 10:06:38 +00:00
|
|
|
$releaseJsonOutPath = [Environment]::GetFolderPath('MyDocuments') + "\_projekti\nadeko-installers\$versionNumber\"
|
2019-09-21 13:15:20 +00:00
|
|
|
New-Item -Path $releaseJsonOutPath -Value $jsonReleaseFile -Name "releases.json" -Force
|
2017-06-09 16:47:50 +00:00
|
|
|
}
|