50 lines
1.3 KiB
YAML
50 lines
1.3 KiB
YAML
name: Create Test Construct
|
|
run-name: Creating test construct
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
branches: [dev, "test/**"]
|
|
paths: ["back/**"]
|
|
workflow_dispatch:
|
|
inputs:
|
|
branch:
|
|
description: "Branch to deploy"
|
|
required: true
|
|
default: "dev"
|
|
workflow_call:
|
|
|
|
jobs:
|
|
build_and_deploy:
|
|
runs-on: windows
|
|
|
|
steps:
|
|
- name: Checkout branch
|
|
uses: actions/checkout@v4
|
|
|
|
# build .net project
|
|
- name: Build .NET Project
|
|
run: |
|
|
dotnet restore
|
|
dotnet build
|
|
|
|
# deploy .net to iis site with path = "D:\iis\es\mcvingenieros\mmorales.photo\back"
|
|
- name: Deploy .net project to iis
|
|
shell: powershell
|
|
run: |
|
|
# deploy to iis site back.mmorales.photo that has path = D:\iis\es\mcvingenieros\mmorales.photo\back\
|
|
$sourcePath = "D:\iis\es\mcvingenieros\mmorales.photo\back\bin\Release\net9.0\publish"
|
|
$destinationPath = "D:\iis\es\mcvingenieros\mmorales.photo\back\"
|
|
|
|
# Stop IIS site
|
|
Stop-WebAppPool -Name "mmorales.photo.back"
|
|
|
|
# Remove old files
|
|
Remove-Item -Path $destinationPath\* -Recurse -Force
|
|
|
|
# Copy new files
|
|
Copy-Item -Path $sourcePath\* -Destination $destinationPath -Recurse
|
|
|
|
# Start IIS site
|
|
Start-WebAppPool -Name "mmorales.photo.back"
|