Skip to content

Commit

Permalink
Copy files and updated host names in Publish.ps1 instead of Build.yml.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Apr 10, 2021
1 parent 32220ad commit 5d333d5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ jobs:
shell: powershell
run: |
.\Utilities\Publish.ps1 -CertificatePath "$env:GITHUB_WORKSPACE\GitHubActionsWorkflow.pfx" -CertificatePassword $env:PfxKey -Hostname $env:SiteUrl -CurrentVersion $env:CurrentVersion -RID linux-x64 -OutDir "$env:GITHUB_WORKSPACE\publish"
- name: Copy server install scripts
shell: powershell
run: |
Copy-Item -Path ".\Utilities\Ubuntu_Server_Install.sh" -Destination ".\publish\Ubuntu_Server_Install.sh" -Force
Copy-Item -Path ".\Utilities\CentOS_Server_Install.sh" -Destination ".\publish\CentOS_Server_Install.sh" -Force
Copy-Item -Path ".\Utilities\Install-RemotelyServer.ps1" -Destination ".\publish\Install-RemotelyServer.ps1" -Force
# Upload build artifact to be deployed from Ubuntu runner
- name: Upload build artifact
Expand Down
7 changes: 1 addition & 6 deletions Utilities/Install-RemotelyServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ param (
# The name to use for the IIS site.
[Parameter(Mandatory=$True)]
[string]$SiteName,
# The folder path where the Remotely server files should be located.
[Parameter(Mandatory=$True)]
[string]$SitePath,
# The hostname that IIS will use for the site (e.g. remotely.mydomain.com).
[Parameter(Mandatory=$True)]
[string]$BindingHostname,
# Whether to run the script without any prompts.
[switch]$Quiet,
# The path to Windows ACME Simple (wacs.exe) to use for automatically obtaining and
Expand All @@ -42,6 +36,7 @@ if ($PSScriptRoot -eq ""){
}

$Root = (Get-Item -Path $PSScriptRoot).Parent.FullName
$BindingHostname = ""
#endregion

#region Functions
Expand Down
10 changes: 10 additions & 0 deletions Utilities/Publish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,17 @@ if ($RID.Length -gt 0 -and $OutDir.Length -gt 0) {
if ((Test-Path -Path $OutDir) -eq $false){
New-Item -Path $OutDir -ItemType Directory
}

dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion --runtime $RID --configuration Release --output $OutDir "$Root\Server\"

Copy-Item -Path "$Root\Utilities\Ubuntu_Server_Install.sh" -Destination "$OutDir\Ubuntu_Server_Install.sh" -Force
Replace-LineInFile -FilePath "$OutDir\Ubuntu_Server_Install.sh" -MatchPattern "HostName=`"`"" -ReplaceLineWith "HostName=`"$($HostNameUri.Host)`""

Copy-Item -Path "$Root\Utilities\CentOS_Server_Install.sh" -Destination "$OutDir\CentOS_Server_Install.sh" -Force
Replace-LineInFile -FilePath "$OutDir\CentOS_Server_Install.sh" -MatchPattern "HostName=`"`"" -ReplaceLineWith "HostName=`"$($HostNameUri.Host)`""

Copy-Item -Path "$Root\Utilities\Install-RemotelyServer.ps1" -Destination "$OutDir\Install-RemotelyServer.ps1" -Force
Replace-LineInFile -FilePath "$OutDir\CentOS_Server_Install.sh" -MatchPattern "`$BindingHostname = `"`"" -ReplaceLineWith "`$BindingHostname = `"$($HostNameUri.Host)`""
}
else {
Write-Host "`nSkipping server deployment. Params -outdir and -rid not specified." -ForegroundColor DarkYellow
Expand Down

0 comments on commit 5d333d5

Please sign in to comment.