CICD deploy.yml

This commit is contained in:
rowell_m_soriano 2026-06-25 16:05:33 +08:00
parent 3c0be5eae2
commit 3d82fb67ba

View File

@ -0,0 +1,39 @@
name: Build and Deploy CPRNIMS
on:
push:
branches: [ main ]
jobs:
build-and-deploy:
runs-on: windows
steps:
- name: Checkout
uses: actions/checkout@v4
# ---- Build both .NET projects ----
- name: Publish WebApi
run: dotnet publish .\CPRNIMS.WebApi\CPRNIMS.WebApi.csproj -c Release -o D:\ci-output\webapi
shell: pwsh
- name: Publish WebApps
run: dotnet publish .\CPRNIMS.WebApps\CPRNIMS.WebApps.csproj -c Release -o D:\ci-output\webapps
shell: pwsh
# ---- Deploy to IIS server over SSH ----
- name: Stop app pools
run: |
ssh -i D:\gitea-runner\deploy_key lliadmin@212.47.72.54 "Import-Module WebAdministration; Stop-WebAppPool -Name 'CPRNIMS-Api'; Stop-WebAppPool -Name 'CPRNIMS-Web'; Start-Sleep -Seconds 3"
shell: pwsh
- name: Copy WebApi
run: scp -i D:\gitea-runner\deploy_key -r D:\ci-output\webapi\* lliadmin@212.47.72.54:C:/inetpub/cprnims-api/
shell: pwsh
- name: Copy WebApps
run: scp -i D:\gitea-runner\deploy_key -r D:\ci-output\webapps\* lliadmin@212.47.72.54:C:/inetpub/cprnims-web/
shell: pwsh
- name: Start app pools
run: |
ssh -i D:\gitea-runner\deploy_key lliadmin@212.47.72.54 "Import-Module WebAdministration; Start-WebAppPool -Name 'CPRNIMS-Api'; Start-WebAppPool -Name 'CPRNIMS-Web'"
shell: pwsh