Skip to content

feat: Update info card layout and styles for sighting details, add ac… #18

feat: Update info card layout and styles for sighting details, add ac…

feat: Update info card layout and styles for sighting details, add ac… #18

Workflow file for this run

#
#
# make sure you elevate permissions on the server so that we can run the IIS app
# cmd stop and start command:
# NOTE: This needs to be run in CMD and not Powershell
# sc config actions.runner.VirginMaryIslamicCenter.sqlstaging-vmic obj= "NT AUTHORITY\SYSTEM" type= own
# sc config actions.runner.VirginMaryIslamicCenter-Website.SQL-MAIN obj= "NT AUTHORITY\SYSTEM" type= own
# (get the name from the Windows Services window)
# ^ Make sure you restart the service or server after running this command
#
name: Deploy to All Servers
env:
IIS_SITE_NAME: 'IslamicMonth.com'
APP_POOL: 'IslamicMonth.com'
FINAL_DIR: 'd:\web.net\IslamicMonth'
on:
push:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
node-version: [20.x]
runner: [sqlstaging-vmic]
steps:
- uses: actions/checkout@v6
# ==========================================
# Install Node and NPM dependencies
# ==========================================
- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Configure persistent npm cache
shell: powershell
run: |
$npmCacheDir = "D:\npm-cache-islamicmonth"
if (-not (Test-Path $npmCacheDir)) {
New-Item -ItemType Directory -Path $npmCacheDir -Force | Out-Null
Write-Output "Created npm cache directory: $npmCacheDir"
}
npm config set cache $npmCacheDir
Write-Output "npm cache configured to: $npmCacheDir"
- name: npm install
run: |
npm ci --ignore-scripts
# ==========================================
# BUILD ANGULAR
# ==========================================
- name: build angular
run: |
npm run build
env:
NODE_ENV: production
NG_BUILD_CACHE: 'true'
# ==========================================
# BUILD .NET
# ==========================================
- name: 'Check if .NET 9 is installed globally'
id: check-dotnet
shell: powershell
run: |
try {
$dotnetVersion = dotnet --version
Write-Output "Current .NET version: $dotnetVersion"
$majorVersion = $dotnetVersion.Split('.')[0]
if ($majorVersion -eq "9") {
Write-Output "DOTNET_INSTALLED=true" >> $env:GITHUB_OUTPUT
Write-Output ".NET 9 is already installed globally"
} else {
Write-Output "DOTNET_INSTALLED=false" >> $env:GITHUB_OUTPUT
Write-Output ".NET 9 is not installed. Found version $majorVersion instead"
}
} catch {
Write-Output "DOTNET_INSTALLED=false" >> $env:GITHUB_OUTPUT
Write-Output ".NET is not installed on the system"
}
- name: Setup .NET 9
if: steps.check-dotnet.outputs.DOTNET_INSTALLED != 'true'
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: 'Configure persistent NuGet cache directory'
shell: powershell
run: |
$nugetCacheDir = "D:\nuget-cache"
if (-not (Test-Path $nugetCacheDir)) {
New-Item -ItemType Directory -Path $nugetCacheDir -Force | Out-Null
Write-Output "Created NuGet cache directory: $nugetCacheDir"
}
$env:NUGET_PACKAGES = $nugetCacheDir
[Environment]::SetEnvironmentVariable("NUGET_PACKAGES", $nugetCacheDir, "User")
Write-Output "NuGet cache configured to: $nugetCacheDir"
- name: Copy Angular output to wwwroot
run: |
if (Test-Path "server\wwwroot") { Remove-Item "server\wwwroot" -Recurse -Force }
Copy-Item -Path "dist\islamic-month\browser" -Destination "server\wwwroot" -Recurse
- name: Publish .NET project
run: |
dotnet publish server\MoonSightingMaps.csproj -c Release -o server\publish -p:EnableNETAnalyzers=false -p:RunAnalyzersDuringBuild=false -p:GenerateDocumentationFile=false /maxcpucount /p:BuildInParallel=true
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 'true'
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
# ==========================================
# DEPLOY
# ==========================================
- name: STOP APP (Make sure you give elevated permissions as listed in main.yml at the top)
if: always()
uses: nick-fields/retry@v2
with:
timeout_minutes: 6
max_attempts: 4
retry_on: error
command: |
import-module WebAdministration
c:\windows\system32\inetsrv\appcmd stop site /site.name:${{ env.IIS_SITE_NAME }}
Start-Sleep -Seconds 1
if((Get-WebAppPoolState -Name "${{ env.APP_POOL }}").Value -ne 'Stopped'){
c:\windows\System32\inetsrv\appcmd recycle apppool /apppool.name:"${{ env.APP_POOL }}"
Write-Output ('Stopping Application Pool: {0}' -f "${{ env.APP_POOL }}")
Stop-WebAppPool -Name "${{ env.APP_POOL }}"
}
Start-Sleep -Seconds 1
- name: COPY MAINTENANCE PAGE TO DEPLOYMENT DIRECTORY
run: |
Copy-Item ".github\workflows\maintenance.html" "${{ env.FINAL_DIR }}\app_offline.htm" -Force
Write-Output "Maintenance page deployed (app_offline.htm)"
- name: COPY FILES (differential sync — only copies changed files)
uses: nick-fields/retry@v2
with:
timeout_minutes: 15
max_attempts: 10
retry_on: error
command: |
robocopy "server\publish" "${{ env.FINAL_DIR }}" /MIR /XF app_offline.htm /MT:32 /R:0 /W:0 /NFL /NDL /NJH /NJS /NC /NS /NP
if ($LASTEXITCODE -le 7) { exit 0 } else { exit $LASTEXITCODE }
- name: REMOVE MAINTENANCE PAGE
if: always()
run: |
$maintenanceFile = "${{ env.FINAL_DIR }}\app_offline.htm"
if (Test-Path $maintenanceFile) {
Remove-Item $maintenanceFile -Force
Write-Output "Maintenance page removed (app_offline.htm)"
}
- name: START APP - Deploy to IIS
if: always()
uses: nick-fields/retry@v2
with:
timeout_minutes: 15
max_attempts: 10
retry_on: error
command: |
import-module WebAdministration
if((Get-WebAppPoolState -Name "${{ env.APP_POOL }}").Value -ne 'Started'){
Write-Output ('Starting Application Pool: {0}' -f "${{ env.APP_POOL }}")
Start-WebAppPool -Name "${{ env.APP_POOL }}"
}
c:\windows\system32\inetsrv\appcmd start site /site.name:${{ env.IIS_SITE_NAME }}