Skip to content

Commit

Permalink
Publish v2.4.319
Browse files Browse the repository at this point in the history
  • Loading branch information
trudyhood committed Nov 24, 2022
1 parent a20d020 commit 043c86b
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 295 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -495,5 +495,6 @@






22 changes: 0 additions & 22 deletions VpnHood.App.Launcher/Updater/PublishInfo2.cs

This file was deleted.

112 changes: 0 additions & 112 deletions VpnHood.App.Launcher/Updater/Updater2.cs

This file was deleted.

18 changes: 0 additions & 18 deletions VpnHood.App.Launcher/Updater/UpdaterOptions2.cs

This file was deleted.

7 changes: 0 additions & 7 deletions VpnHood.Server.App.Net/Install/VpnHoodServer-linux.run.sh

This file was deleted.

116 changes: 0 additions & 116 deletions VpnHood.Server.App.Net/Install/VpnHoodServer-linux.sh

This file was deleted.

59 changes: 39 additions & 20 deletions VpnHood.Server.App.Net/_publish.ps1
Expand Up @@ -12,51 +12,70 @@ $projectDir = $PSScriptRoot;
$projectFile = (Get-ChildItem -path $projectDir -file -Filter "*.csproj").FullName;

# Creating linux package
$templateDir = "$PSScriptRoot/Install/Linux";
$template_installScriptFile = "$templateDir/install.sh";
$template_launcherFile = "$templateDir/vhserver.sh";
$template_updaterFile = "$templateDir/updater.sh";

$publishDir = "$projectDir/bin/release/publish-linux";
$packageFileName = "VpnHoodServer-linux.tar.gz";
$installScriptFileName = "VpnHoodServer-linux.sh";
$publishInfoPackageFileName = "VpnHoodServer-linux.json";
$releaseInfoDir = "$publishDir/$versionTag/publish_info";
$publishInfoFileName = "publish.json";
$launcherFileName = "vhserver";
$publish_infoDir = "$publishDir/$versionTag/publish_info";
$publish_updaterFile = "$publish_infoDir/update";
$publish_launcherFile = "$publish_infoDir/vhserver";
$publish_InfoFile = "$publish_infoDir/publish.json";

$module_InfoFile = "$moduleDir/VpnHoodServer-linux.json";
$module_InstallerFile = "$moduleDir/VpnHoodServer-linux.sh";
$module_PackageFile = "$moduleDir/VpnHoodServer-linux.tar.gz";

# Calcualted Path
$module_InfoFileName = $(Split-Path "$module_InfoFile" -leaf);
$module_PackageFileName = $(Split-Path "$module_PackageFile" -leaf);
$module_InstallerFileName = $(Split-Path "$module_InstallerFile" -leaf);

# prepare publish folder
try { Remove-Item -path "$publishDir" -Force -Recurse } catch {}
New-Item -ItemType Directory -Path $publish_infoDir -Force | Out-Null;

# publish
echo "Build Linux Server...";
if (-not $noclean) { dotnet clean "$projectDir" -c "Release" --output $publishDir | Out-Null }
try { Remove-Item -path "$publishDir" -Force -Recurse } catch {}
dotnet publish "$projectDir" -c "Release" --output "$publishDir/$versionTag" --framework "net7.0" --self-contained --runtime "linux-x64" /p:Version=$versionParam
dotnet publish "$projectDir" -c "Release" --output "$publishDir/$versionTag" --framework "net7.0" --self-contained --runtime "win-x64" /p:Version=$versionParam
if ($LASTEXITCODE -gt 0) { Throw "The publish exited with error code: " + $lastexitcode; }
New-Item -ItemType Directory -Path $releaseInfoDir -Force | Out-Null;

# server install-linux.sh
# create installation script
echo "Creating Linux Server installation script...";
$linuxScript = Get-Content -Path "$PSScriptRoot/Install/$installScriptFileName" -Raw;
$linuxScript = $linuxScript.Replace('$packageUrlParam', "https://github.com/vpnhood/VpnHood/releases/download/$versionTag/$packageFileName");
$linuxScript = Get-Content -Path "$template_installScriptFile" -Raw;
$linuxScript = $linuxScript.Replace('$packageUrlParam', "https://github.com/vpnhood/VpnHood/releases/download/$versionTag/$module_packageFileName");
$linuxScript = $linuxScript.Replace('$versionTagParam', "$versionTag");
$linuxScript = $linuxScript -replace "`r`n", "`n";
$linuxScript | Out-File -FilePath "$moduleDir/$installScriptFileName" -Encoding ASCII -Force -NoNewline;
$linuxScript | Out-File -FilePath "$module_InstallerFile" -Encoding ASCII -Force -NoNewline;

# launcher script
echo "Creating Linux Server launcher script...";
$exeFile = "$versionTag/VpnHoodServer";
$linuxScript = (Get-Content -Path "$PSScriptRoot/Install/VpnHoodServer-linux.run.sh" -Raw).Replace('{exeFileParam}', $exeFile);
$linuxScript = (Get-Content -Path "$template_launcherFile" -Raw).Replace('{exeFileParam}', $exeFile);
$linuxScript = $linuxScript -replace "`r`n", "`n";
$linuxScript | Out-File -FilePath "$releaseInfoDir/$launcherFileName" -Encoding ASCII -Force -NoNewline;
$linuxScript | Out-File -FilePath "$publish_launcherFile" -Encoding ASCII -Force -NoNewline;

# updater script
echo "Creating Linux Server updater script...";
Copy-Item -path "$template_updaterFile" -Destination "$publish_updaterFile" -Force -Recurse

# publish info
$json = @{
Version=$versionParam;
ExeFile=$exeFile;
UpdateInfoUrl="https://github.com/vpnhood/VpnHood/releases/latest/download/$publishInfoPackageFileName";
UpdateScriptUrl="https://github.com/vpnhood/VpnHood/releases/latest/download/$installScriptFileName";
UpdateInfoUrl="https://github.com/vpnhood/VpnHood/releases/latest/download/$module_InfoFileName";
InstallScriptUrl="https://github.com/vpnhood/VpnHood/releases/download/$versionTag/$module_InstallerFileName";
UpdateCode="5EE5047D-6E67-43D4-A90D-665813CA1E7F"
};

$json | ConvertTo-Json | Out-File "$releaseInfoDir/$publishInfoFileName" -Encoding utf8;
$json | ConvertTo-Json | Out-File "$moduleDir/$publishInfoPackageFileName" -Encoding utf8;
$json | ConvertTo-Json | Out-File "$publish_InfoFile" -Encoding utf8;
$json | ConvertTo-Json | Out-File "$module_InfoFile" -Encoding utf8;

# zip
echo "Compressing Linux Server package...";
tar -czf $moduleDir/$packageFileName -C "$publishDir\" *;
tar -czf "$module_PackageFile" -C "$publishDir\" *;

if ($isLatest)
{
Expand Down

0 comments on commit 043c86b

Please sign in to comment.