-
Notifications
You must be signed in to change notification settings - Fork 36
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
4 changed files
with
116 additions
and
0 deletions.
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
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,30 @@ | ||
rem Build dll | ||
echo Loading Visual Studio Tools | ||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" | ||
|
||
echo Compiling Dll | ||
msbuild ..\KeeTheme.sln /p:Configuration=Release /p:LangVersion=3 | ||
|
||
echo Releasing Dll | ||
copy ..\KeeTheme\bin\Release\KeeTheme.dll .\KeeTheme.dll | ||
|
||
rem Build plgx | ||
echo Deleting existing PlgX folder | ||
rmdir /s /q "PlgX" | ||
|
||
echo Creating PlgX folder | ||
mkdir "PlgX" | ||
|
||
echo Copying files | ||
xcopy "..\KeeTheme\*" "PlgX" /s /e /exclude:PlgXExclude.txt | ||
|
||
echo Compiling PlgX | ||
"C:\Program Files (x86)\KeePass Password Safe 2\KeePass.exe" /plgx-create "%cd%\PlgX" --debug --plgx-prereq-net:3.5 | ||
|
||
echo Releasing PlgX | ||
move /y "PlgX.plgx" "KeeTheme.plgx" | ||
|
||
echo Cleaning up | ||
rmdir /s /q "PlgX" | ||
|
||
pause |
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,13 @@ | ||
bin\ | ||
obj\ | ||
.idea\ | ||
.vs | ||
.git | ||
.user | ||
.sln | ||
.suo | ||
.pdb | ||
build.cmd | ||
plgxexclude.txt | ||
KeeTheme.dll | ||
KeeTheme.plgx |
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,65 @@ | ||
param ( | ||
[string]$apiKey = "" | ||
) | ||
|
||
If ($apiKey -eq "") | ||
{ | ||
Write-Host "Choco API key was not provided. Trying to read from choco.key file." | ||
$apiKey = Get-Content choco.key | ||
} | ||
|
||
If ($apiKey -eq "") | ||
{ | ||
Write-Host "Choco API key not found!" | ||
Break | ||
} | ||
|
||
Write-Host "Getting latest KeeTheme version..." | ||
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12' | ||
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols | ||
|
||
$latestUrl = "https://github.com/xatupal/KeeTheme/releases/latest" | ||
$request = [System.Net.WebRequest]::Create($latestUrl) | ||
$request.AllowAutoRedirect=$false | ||
$response=$request.GetResponse() | ||
|
||
If ($response.StatusCode -ne "Found") | ||
{ | ||
Write-Host "Unable to find latest version!" | ||
Break | ||
} | ||
|
||
$latestTagUrl = $response.GetResponseHeader("Location") | ||
$latestTag = $latestTagUrl -Split "/" | Select-Object -Last 1 | ||
$version = $latestTag.TrimStart("v") | ||
Write-Host "Latest version: " $version | ||
|
||
Write-Host "Downloading KeeTheme.plgx..." | ||
$downloadUrl = "https://github.com/xatupal/KeeTheme/releases/download/$latestTag/KeeTheme.plgx" | ||
Invoke-WebRequest -Uri $downloadUrl -OutFile "KeeTheme.plgx" | ||
Write-Host "KeeTheme plugin downloaded" | ||
|
||
Write-Host "Updating Choco files..." | ||
$content = Get-Content -path "keetheme.nuspec" | ||
$content -Replace '\<version\>(.+)\</version\>', "<version>$version</version>" | Out-File -Encoding "UTF8" "keetheme.nuspec" | ||
|
||
$content = Get-Content -path "tools\common.ps1" | ||
$content -Replace '\$url = ''(.+)''', "`$url = '$downloadUrl'" | Out-File -Encoding "UTF8" "tools\common.ps1" | ||
|
||
$checksum = (Get-FileHash -algorithm sha256 "KeeTheme.plgx").Hash | ||
$content = Get-Content -path "tools\common.ps1" | ||
$content -Replace '\$checksum = ''(.+)''', "`$checksum = '$checksum'" | Out-File -Encoding "UTF8" "tools\common.ps1" | ||
Write-Host "Choco files updated" | ||
|
||
Write-Host "Creating Choco package..." | ||
choco pack | ||
Write-Host "Choco package keepass-plugin-keetheme.$version.nupkg created!" | ||
|
||
$reply = Read-Host -Prompt "Ready to push?[y/n]" | ||
If ($reply -match "[yY]") | ||
{ | ||
Write-Host "Pushing Choco package..." | ||
choco push keepass-plugin-keetheme.$version.nupkg -s https://chocolatey.org --api-key=$apiKey | ||
Write-Host "Choco package pushed!" | ||
} | ||
pause |