From 64f841052b445b55bb0cd5079408b7d6dcd5cc47 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Sun, 11 Jun 2017 02:26:19 +0200 Subject: [PATCH] Bot should update properly now. Credentials shouldn't be replaced by updates. --- NadekoBot.iss | 24 ++++++++++++++++----- release.ps1 | 12 ++++++++--- src/NadekoBot/Services/Impl/StatsService.cs | 2 +- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/NadekoBot.iss b/NadekoBot.iss index b0c226f6..e933c4d0 100644 --- a/NadekoBot.iss +++ b/NadekoBot.iss @@ -1,5 +1,5 @@ #define sysfolder "system" -#define version GetEnv('NADEKOBOT_INSTALL_VERSION') +#define version GetEnv("NADEKOBOT_INSTALL_VERSION") #define target "win7-x64" [Setup] @@ -20,14 +20,14 @@ DisableWelcomePage=no [Files] ;install -Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: recursesubdirs onlyifdoesntexist ignoreversion createallsubdirs; Excludes: "*.pdb, *.db" +Source: "src\NadekoBot\bin\Release\netcoreapp1.1\{#target}\publish\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: recursesubdirs onlyifdoesntexist ignoreversion createallsubdirs; Excludes: "*.pdb, *.db" ;rename credentials example to credentials, but don't overwrite if it exists -Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\credentials_example.json"; DestName: "credentials.json"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: skipifsourcedoesntexist onlyifdoesntexist; +;Source: "src\NadekoBot\bin\Release\netcoreapp1.1\{#target}\publish\credentials_example.json"; DestName: "credentials.json"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: skipifsourcedoesntexist onlyifdoesntexist; ;reinstall - i want to copy all files, but i don't want to overwrite any data files because users will lose their customization if they don't have a backup, ; and i don't want them to have to backup and then copy-merge into data folder themselves, or lose their currency images due to overwrite. -Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: recursesubdirs onlyifdestfileexists createallsubdirs; Excludes: "*.pdb, *.db, data\*, credentials.json"; -Source: "src\NadekoBot\bin\Release\PublishOutput\{#target}\data\*"; DestDir: "{app}\{#sysfolder}\data"; Permissions: users-full; Flags: recursesubdirs onlyifdoesntexist createallsubdirs; +Source: "src\NadekoBot\bin\Release\netcoreapp1.1\{#target}\publish\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: recursesubdirs ignoreversion onlyifdestfileexists createallsubdirs; Excludes: "*.pdb, *.db, data\*, credentials.json"; +Source: "src\NadekoBot\bin\Release\netcoreapp1.1\{#target}\publish\data\*"; DestDir: "{app}\{#sysfolder}\data"; Permissions: users-full; Flags: recursesubdirs onlyifdoesntexist createallsubdirs; ;readme ;Source: "readme"; DestDir: "{app}"; Flags: isreadme @@ -83,4 +83,18 @@ begin MsgBox(X + '\{#sysfolder}\data\NadekoBot.db doesn''t exist', mbConfirmation, MB_YESNO) end end; +end; + +function GetFileName(const AFileName: string): string; +begin + Result := ExpandConstant('{app}\{#sysfolder}\' + AFileName); +end; + +procedure CurStepChanged(CurStep: TSetupStep); +begin + if (CurStep = ssInstall) then + begin + if FileExists(GetFileName('credentials_example.json')) and not FileExists(GetFileName('credentials.json')) then + RenameFile(GetFileName('credentials_example.json'), GetFileName('credentials.json')); + end; end; \ No newline at end of file diff --git a/release.ps1 b/release.ps1 index 129e2f4f..630ec22c 100644 --- a/release.ps1 +++ b/release.ps1 @@ -15,12 +15,17 @@ function GitHub-Release($versionNumber) $changelog = [string]::join([Environment]::NewLine, $changelog) $cl2 = $clArr | where { "$_" -like "*Merge pull request*" } - $cl2 = [string]::join([Environment]::NewLine, $cl2) - - $changelog = "## Changes$nl$changelog$nl ## Pull Requests Merged$nl$cl2" + $changelog = "## Changes$nl$changelog" + if ($cl2 -ne $null) + { + $cl2 = [string]::join([Environment]::NewLine, $cl2) + $changelog = $changelog + "$nl ## Pull Requests Merged$nl$cl2" + } Write-Host $changelog + dotnet publish -c Release --runtime win7-x64 + # set-alias sz "$env:ProgramFiles\7-Zip\7z.exe" # $source = "src\NadekoBot\bin\Release\PublishOutput\win7-x64" # $target = "src\NadekoBot\bin\Release\PublishOutput\NadekoBot.7z" @@ -54,6 +59,7 @@ function GitHub-Release($versionNumber) $result = Invoke-RestMethod @uploadParams Write-Host 'Artifact upload finished.' $result = GitHubMake-Release $versionNumber $commitId $FALSE $gitHubApiKey $auth "$releaseId" + git pull Write-Host 'Done 🎉' } diff --git a/src/NadekoBot/Services/Impl/StatsService.cs b/src/NadekoBot/Services/Impl/StatsService.cs index 6e03c5e8..7c04c2c7 100644 --- a/src/NadekoBot/Services/Impl/StatsService.cs +++ b/src/NadekoBot/Services/Impl/StatsService.cs @@ -17,7 +17,7 @@ namespace NadekoBot.Services.Impl private readonly IBotCredentials _creds; private readonly DateTime _started; - public const string BotVersion = "1.41.1"; + public const string BotVersion = "1.41.2"; public string Author => "Kwoth#2560"; public string Library => "Discord.Net";