49 lines
1.2 KiB
YAML
49 lines
1.2 KiB
YAML
name: deploy front
|
|
run-name: Deploy Frontend
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
branches: [dev, "test/**"]
|
|
paths: ["front/**"]
|
|
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 angular
|
|
- name: Build Angular
|
|
run: |
|
|
npm install
|
|
npm run build
|
|
|
|
- name: Deploy to IIS
|
|
shell: powershell
|
|
run: |
|
|
# deploy to iis site front.mmorales.photo that has path = D:\iis\es\mcvingenieros\mmorales.photo\front\
|
|
$sourcePath = "D:\iis\es\mcvingenieros\mmorales.photo\front\dist"
|
|
$destinationPath = "D:\iis\es\mcvingenieros\mmorales.photo\front\"
|
|
|
|
# Stop IIS site
|
|
Stop-WebAppPool -Name "mmorales.photo.front"
|
|
|
|
# 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.front"
|