Update build.yml
This commit is contained in:
21
.github/workflows/build.yml
vendored
21
.github/workflows/build.yml
vendored
@@ -4,11 +4,27 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master # Change to your default branch if different
|
- master # Change to your default branch if different
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
environment:
|
||||||
|
description: 'Environment to deploy to'
|
||||||
|
required: true
|
||||||
|
default: 'prod'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- prod
|
||||||
|
- dev
|
||||||
|
- test
|
||||||
|
restart_iis:
|
||||||
|
description: 'Restart IIS after deployment'
|
||||||
|
required: true
|
||||||
|
default: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: self-hosted # Ensure your self-hosted runner is configured
|
runs-on: self-hosted # Ensure your self-hosted runner is configured
|
||||||
environment: 'prod'
|
environment: ${{ github.event.inputs.environment || 'prod' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Get Current User
|
- name: Get Current User
|
||||||
run: |
|
run: |
|
||||||
@@ -79,7 +95,7 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
runs-on: self-hosted # Ensure your self-hosted runner is configured
|
runs-on: self-hosted # Ensure your self-hosted runner is configured
|
||||||
needs: build
|
needs: build
|
||||||
environment: 'prod'
|
environment: ${{ github.event.inputs.environment || 'prod' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download .NET Artifacts
|
- name: Download .NET Artifacts
|
||||||
@@ -97,6 +113,7 @@ jobs:
|
|||||||
xcopy ".\output\dotnet\*" "C:\inetpub\applications\HomeApi" /s /i /y
|
xcopy ".\output\dotnet\*" "C:\inetpub\applications\HomeApi" /s /i /y
|
||||||
|
|
||||||
- name: Restart IIS Application Pool
|
- name: Restart IIS Application Pool
|
||||||
|
if: ${{ github.event.inputs.restart_iis != 'false' }}
|
||||||
run: |
|
run: |
|
||||||
Import-Module WebAdministration
|
Import-Module WebAdministration
|
||||||
$appPoolName = "${{ vars.IIS_APP_POOL_NAME }}" -or "HomeApi"
|
$appPoolName = "${{ vars.IIS_APP_POOL_NAME }}" -or "HomeApi"
|
||||||
|
|||||||
Reference in New Issue
Block a user