Add webapp release
Some checks failed
Queue Release Build / prepare (push) Successful in 22s
Deploy Web Apps / deploy (push) Has been cancelled
Queue Release Build / build-windows (push) Has been cancelled
Queue Release Build / finalize (push) Has been cancelled
Queue Release Build / build-linux (push) Has been cancelled
Some checks failed
Queue Release Build / prepare (push) Successful in 22s
Deploy Web Apps / deploy (push) Has been cancelled
Queue Release Build / build-windows (push) Has been cancelled
Queue Release Build / finalize (push) Has been cancelled
Queue Release Build / build-linux (push) Has been cancelled
This commit is contained in:
43
.gitea/workflows/deploy-web-apps.yml
Normal file
43
.gitea/workflows/deploy-web-apps.yml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
name: Deploy Web Apps
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, master]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: windows
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: powershell
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install root dependencies
|
||||||
|
env:
|
||||||
|
NODE_ENV: development
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Install website dependencies
|
||||||
|
env:
|
||||||
|
NODE_ENV: development
|
||||||
|
run: npm ci --prefix website
|
||||||
|
|
||||||
|
- name: Build Toju web app
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Build Toju website
|
||||||
|
run: |
|
||||||
|
Push-Location website
|
||||||
|
npm run build
|
||||||
|
Pop-Location
|
||||||
|
|
||||||
|
- name: Deploy both apps to IIS
|
||||||
|
run: >
|
||||||
|
./tools/deploy-web-apps.ps1
|
||||||
|
-WebsitePort 4341
|
||||||
|
-AppPort 4492
|
||||||
23
public/web.config
Normal file
23
public/web.config
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<system.webServer>
|
||||||
|
<staticContent>
|
||||||
|
<remove fileExtension=".wasm" />
|
||||||
|
<remove fileExtension=".webmanifest" />
|
||||||
|
<mimeMap fileExtension=".wasm" mimeType="application/wasm" />
|
||||||
|
<mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" />
|
||||||
|
</staticContent>
|
||||||
|
<rewrite>
|
||||||
|
<rules>
|
||||||
|
<rule name="Angular Routes" stopProcessing="true">
|
||||||
|
<match url=".*" />
|
||||||
|
<conditions logicalGrouping="MatchAll">
|
||||||
|
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
|
||||||
|
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
|
||||||
|
</conditions>
|
||||||
|
<action type="Rewrite" url="/index.html" />
|
||||||
|
</rule>
|
||||||
|
</rules>
|
||||||
|
</rewrite>
|
||||||
|
</system.webServer>
|
||||||
|
</configuration>
|
||||||
101
tools/deploy-web-apps.ps1
Normal file
101
tools/deploy-web-apps.ps1
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[string]$RepoRoot = (Split-Path -Parent $PSScriptRoot),
|
||||||
|
[string]$IisRoot = 'C:\inetpub\wwwroot',
|
||||||
|
[int]$WebsitePort = 4341,
|
||||||
|
[int]$AppPort = 4492
|
||||||
|
)
|
||||||
|
|
||||||
|
Set-StrictMode -Version Latest
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
try {
|
||||||
|
Import-Module WebAdministration -ErrorAction Stop
|
||||||
|
} catch {
|
||||||
|
throw 'The IIS WebAdministration module is required on the Windows runner.'
|
||||||
|
}
|
||||||
|
|
||||||
|
function Invoke-RoboCopyMirror {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Source,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Destination
|
||||||
|
)
|
||||||
|
|
||||||
|
if (-not (Test-Path -LiteralPath $Source)) {
|
||||||
|
throw "Build output not found: $Source"
|
||||||
|
}
|
||||||
|
|
||||||
|
New-Item -ItemType Directory -Path $Destination -Force | Out-Null
|
||||||
|
robocopy $Source $Destination /MIR /NFL /NDL /NJH /NJS /NP | Out-Null
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -gt 7) {
|
||||||
|
throw "robocopy failed from $Source to $Destination with exit code $LASTEXITCODE"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Ensure-AppPool {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Name
|
||||||
|
)
|
||||||
|
|
||||||
|
$appPoolPath = "IIS:\AppPools\$Name"
|
||||||
|
|
||||||
|
if (-not (Test-Path -LiteralPath $appPoolPath)) {
|
||||||
|
New-WebAppPool -Name $Name | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
Set-ItemProperty $appPoolPath -Name managedRuntimeVersion -Value ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function Publish-IisSite {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$SiteName,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$SourcePath,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$DestinationPath,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[int]$Port
|
||||||
|
)
|
||||||
|
|
||||||
|
Ensure-AppPool -Name $SiteName
|
||||||
|
Invoke-RoboCopyMirror -Source $SourcePath -Destination $DestinationPath
|
||||||
|
|
||||||
|
$existingSite = Get-Website -Name $SiteName -ErrorAction SilentlyContinue
|
||||||
|
if ($null -ne $existingSite) {
|
||||||
|
Stop-Website -Name $SiteName -ErrorAction SilentlyContinue
|
||||||
|
Remove-Website -Name $SiteName
|
||||||
|
}
|
||||||
|
|
||||||
|
New-Website -Name $SiteName -PhysicalPath $DestinationPath -Port $Port -ApplicationPool $SiteName | Out-Null
|
||||||
|
Start-Website -Name $SiteName
|
||||||
|
|
||||||
|
Write-Host "Deployed $SiteName to $DestinationPath on port $Port."
|
||||||
|
}
|
||||||
|
|
||||||
|
$deployments = @(
|
||||||
|
@{
|
||||||
|
SiteName = 'toju-website'
|
||||||
|
SourcePath = (Join-Path $RepoRoot 'website\dist\toju-website\browser')
|
||||||
|
DestinationPath = (Join-Path $IisRoot 'toju-website')
|
||||||
|
Port = $WebsitePort
|
||||||
|
},
|
||||||
|
@{
|
||||||
|
SiteName = 'toju-app'
|
||||||
|
SourcePath = (Join-Path $RepoRoot 'dist\client\browser')
|
||||||
|
DestinationPath = (Join-Path $IisRoot 'toju-app')
|
||||||
|
Port = $AppPort
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach ($deployment in $deployments) {
|
||||||
|
Publish-IisSite @deployment
|
||||||
|
}
|
||||||
23
website/public/web.config
Normal file
23
website/public/web.config
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<system.webServer>
|
||||||
|
<staticContent>
|
||||||
|
<remove fileExtension=".wasm" />
|
||||||
|
<remove fileExtension=".webmanifest" />
|
||||||
|
<mimeMap fileExtension=".wasm" mimeType="application/wasm" />
|
||||||
|
<mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" />
|
||||||
|
</staticContent>
|
||||||
|
<rewrite>
|
||||||
|
<rules>
|
||||||
|
<rule name="Angular Routes" stopProcessing="true">
|
||||||
|
<match url=".*" />
|
||||||
|
<conditions logicalGrouping="MatchAll">
|
||||||
|
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
|
||||||
|
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
|
||||||
|
</conditions>
|
||||||
|
<action type="Rewrite" url="/index.html" />
|
||||||
|
</rule>
|
||||||
|
</rules>
|
||||||
|
</rewrite>
|
||||||
|
</system.webServer>
|
||||||
|
</configuration>
|
||||||
Reference in New Issue
Block a user