-
Notifications
You must be signed in to change notification settings - Fork 3
/
release.ps1
58 lines (44 loc) · 1.86 KB
/
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
#dotnet publish Flow.Launcher.Plugin.VisualStudio -c Release -r win-x64 --no-self-contained
#Compress-Archive -LiteralPath Flow.Launcher.Plugin.VisualStudio/bin/Release/win-x64/publish -DestinationPath Flow.Launcher.Plugin.VisualStudio/bin/VisualStudio.zip -Force
$PluginJson = Get-Content .\plugin.json -Raw | ConvertFrom-Json
$Name = $PluginJson.Name
$Version = $PluginJson.Version
$ActionKeyword = $PluginJson.ActionKeyword
if (!$Name) {
Write-Output "Invalid Name"
Exit
}
$confirmation = Read-Host "Is Name Valid: $Name ? [y/n]"
while($confirmation -ne "y")
{
if ($confirmation -eq 'n') {exit}
$confirmation = Read-Host "Ready? [y/n]"
}
$FullName = $Name + "-" + $Version
dotnet publish -c Release -r win-x64 --no-self-contained -o .\bin\Release\$FullName
#Compress-Archive -LiteralPath .\bin\Release\$FullName -DestinationPath .\bin\"$FullName.zip" -Force
Do {
$Flow = Get-Process | Where-Object -Property ProcessName -eq 'Flow.Launcher'
if ($Flow) {
Stop-Process $Flow
Start-Sleep 1
}
} Until (!$Flow)
$Folders = Get-ChildItem -Path $env:APPDATA\FlowLauncher\Plugins\ | Where-Object { $_ -Match "$Name-\d.\d.\d" }
foreach ($Folder in $Folders) {
Remove-Item -Recurse $env:APPDATA\FlowLauncher\Plugins\$Folder\ -Force -ErrorAction Stop
}
Copy-Item -Recurse -LiteralPath ./bin/Release/$FullName $env:APPDATA\FlowLauncher\Plugins\ -Force
$Flow = Start-Process $env:LOCALAPPDATA\FlowLauncher\Flow.Launcher.exe -PassThru
#Do {} While ($Flow.WaitForInputIdle(5000) -ne $true)
$null = $Flow.WaitForInputIdle(5000)
# while ($Flow.MainWindowTitle -eq 0)
# {
# Start-Sleep -Milliseconds 1000
# }
$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate('Flow.Launcher')
Start-Sleep 3
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.SendKeys]::SendWait("% ")
[System.Windows.Forms.SendKeys]::SendWait($ActionKeyword)