Skip to content

Commit 28bd72d

Browse files
committed
Revert "🏗️ update deploy script to run on both voiceattacks"
This reverts commit b892979.
1 parent 49e6c83 commit 28bd72d

1 file changed

Lines changed: 28 additions & 112 deletions

File tree

deploy-plugin.ps1

Lines changed: 28 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,59 @@
11
#!/usr/bin/env pwsh
22

33
param(
4-
[ValidateSet("VA1", "VA2", "Both")]
5-
[string]$Version = "Both",
6-
7-
[string]$VA1Path = "C:\Program Files (x86)\Steam\steamapps\common\VoiceAttack\Apps\EliteAPI",
8-
[string]$VA2Path = "C:\Program Files (x86)\Steam\steamapps\common\VoiceAttack 2\Apps\EliteAPI",
9-
10-
[switch]$SkipRestart,
11-
[switch]$NoTest
4+
[string]$DestinationPath = "C:\Program Files (x86)\Steam\steamapps\common\VoiceAttack 2\Apps\EliteAPI",
5+
[switch]$SkipVoiceAttackRestart
126
)
137

148
# Detect if running on Windows
159
$IsWindowsOS = ($PSVersionTable.PSVersion.Major -lt 6) -or ($IsWindows -eq $true)
1610

17-
function Stop-VoiceAttackProcess {
18-
param([string]$ProcessName)
19-
20-
if ($IsWindowsOS) {
21-
try {
22-
$process = Get-Process -Name $ProcessName -ErrorAction SilentlyContinue
23-
if ($process) {
24-
Stop-Process -Name $ProcessName -Force -ErrorAction SilentlyContinue
25-
Write-Host "Stopped $ProcessName." -ForegroundColor Green
26-
Start-Sleep -Seconds 2
27-
}
28-
}
29-
catch {
30-
Write-Host "$ProcessName was not running." -ForegroundColor Yellow
31-
}
32-
}
33-
}
34-
35-
function Start-VoiceAttackProcess {
36-
param([string]$ExePath, [string]$Name)
37-
38-
if ($IsWindowsOS -and (Test-Path $ExePath)) {
39-
Write-Host "Starting $Name..." -ForegroundColor Cyan
40-
Start-Process $ExePath
41-
Write-Host "$Name started." -ForegroundColor Green
42-
}
43-
else {
44-
Write-Warning "$Name not found at: $ExePath"
45-
}
46-
}
47-
48-
function Deploy-Plugin {
49-
param(
50-
[string]$TargetFramework,
51-
[string]$DestinationPath,
52-
[string]$Name
53-
)
11+
Write-Host "Stopping VoiceAttack..." -ForegroundColor Cyan
5412

55-
Write-Host "`nDeploying to $Name ($TargetFramework)..." -ForegroundColor Cyan
56-
57-
# Create destination directory if it doesn't exist
58-
if (-not (Test-Path $DestinationPath)) {
59-
New-Item -ItemType Directory -Path $DestinationPath -Force | Out-Null
60-
}
61-
62-
# Copy all items from build output to destination
63-
$buildOutputPath = "EliteVA/bin/Debug/$TargetFramework/"
64-
if (Test-Path $buildOutputPath) {
65-
Get-ChildItem -Path $buildOutputPath -Filter *.dll | ForEach-Object {
66-
Copy-Item $_.FullName -Destination $DestinationPath -Force
67-
Write-Host " Copied $($_.Name)" -ForegroundColor Gray
68-
}
69-
Write-Host "$Name deployment complete." -ForegroundColor Green
13+
if (-not $SkipVoiceAttackRestart -and $IsWindowsOS) {
14+
try {
15+
Stop-Process -Name "VoiceAttack" -Force -ErrorAction SilentlyContinue
16+
Write-Host "VoiceAttack stopped." -ForegroundColor Green
7017
}
71-
else {
72-
Write-Error "Build output not found at: $buildOutputPath"
73-
return $false
18+
catch {
19+
Write-Host "VoiceAttack was not running." -ForegroundColor Yellow
7420
}
7521

76-
return $true
22+
Start-Sleep -Seconds 2
7723
}
7824

79-
# Stop VoiceAttack instances
80-
if (-not $SkipRestart) {
81-
Write-Host "Stopping VoiceAttack instances..." -ForegroundColor Cyan
82-
83-
if ($Version -eq "VA1" -or $Version -eq "Both") {
84-
Stop-VoiceAttackProcess -ProcessName "VoiceAttack"
85-
}
86-
87-
if ($Version -eq "VA2" -or $Version -eq "Both") {
88-
Stop-VoiceAttackProcess -ProcessName "VoiceAttack"
89-
}
90-
}
91-
92-
# Build plugin
9325
Write-Host "`nBuilding plugin..." -ForegroundColor Cyan
94-
dotnet clean "EliteVA/EliteVA.csproj" -c Debug | Out-Null
26+
dotnet clean "EliteVA/EliteVA.csproj" -c Debug
9527
dotnet build "EliteVA/EliteVA.csproj" -c Debug
9628

9729
if ($LASTEXITCODE -ne 0) {
9830
Write-Error "Build failed!"
9931
exit 1
10032
}
10133

102-
Write-Host "Build successful." -ForegroundColor Green
34+
Write-Host "`nCopying plugin files..." -ForegroundColor Cyan
10335

104-
# Deploy to selected version(s)
105-
$deploySuccess = $true
106-
107-
if ($Version -eq "VA1" -or $Version -eq "Both") {
108-
if (-not (Deploy-Plugin -TargetFramework "net48" -DestinationPath $VA1Path -Name "VoiceAttack 1")) {
109-
$deploySuccess = $false
110-
}
36+
# Create destination directory if it doesn't exist
37+
if (-not (Test-Path $DestinationPath)) {
38+
New-Item -ItemType Directory -Path $DestinationPath -Force | Out-Null
11139
}
11240

113-
if ($Version -eq "VA2" -or $Version -eq "Both") {
114-
if (-not (Deploy-Plugin -TargetFramework "net8.0" -DestinationPath $VA2Path -Name "VoiceAttack 2")) {
115-
$deploySuccess = $false
116-
}
117-
}
118-
119-
if (-not $deploySuccess) {
120-
Write-Error "Deployment failed for one or more versions!"
121-
exit 1
41+
# Copy all items from build output to destination
42+
$buildOutputPath = "EliteVA/bin/Debug/net8.0/"
43+
Get-ChildItem -Path $buildOutputPath -Filter *.dll | ForEach-Object {
44+
Copy-Item $_.FullName -Destination $DestinationPath -Force
12245
}
12346

124-
# Start VoiceAttack for testing
125-
if (-not $SkipRestart -and -not $NoTest) {
126-
Write-Host "`nStarting VoiceAttack for testing..." -ForegroundColor Cyan
47+
Write-Host "Plugin deployed successfully." -ForegroundColor Green
12748

128-
if ($Version -eq "VA1") {
129-
$va1Exe = "C:\Program Files (x86)\Steam\steamapps\common\VoiceAttack\VoiceAttack.exe"
130-
Start-VoiceAttackProcess -ExePath $va1Exe -Name "VoiceAttack 1"
49+
if (-not $SkipVoiceAttackRestart -and $IsWindowsOS) {
50+
Write-Host "`nStarting VoiceAttack..." -ForegroundColor Cyan
51+
$voiceAttackExe = "C:\Program Files (x86)\Steam\steamapps\common\VoiceAttack 2\VoiceAttack.exe"
52+
if (Test-Path $voiceAttackExe) {
53+
Start-Process $voiceAttackExe
54+
Write-Host "Done!" -ForegroundColor Green
13155
}
132-
elseif ($Version -eq "VA2") {
133-
$va2Exe = "C:\Program Files (x86)\Steam\steamapps\common\VoiceAttack 2\VoiceAttack.exe"
134-
Start-VoiceAttackProcess -ExePath $va2Exe -Name "VoiceAttack 2"
135-
}
136-
elseif ($Version -eq "Both") {
137-
Write-Host "`nBoth versions deployed. Start manually to test:" -ForegroundColor Yellow
138-
Write-Host " VA1: $(Join-Path (Split-Path $VA1Path -Parent) 'VoiceAttack.exe')" -ForegroundColor Gray
139-
Write-Host " VA2: C:\Program Files (x86)\Steam\steamapps\common\VoiceAttack 2\VoiceAttack.exe" -ForegroundColor Gray
56+
else {
57+
Write-Warning "VoiceAttack.exe not found at: $voiceAttackExe"
14058
}
14159
}
142-
143-
Write-Host "`nDone!" -ForegroundColor Green

0 commit comments

Comments
 (0)