Self Hosted Windows Server

name: Method 2 - Self Hosted Windows Runner

on: 
  # push:
    # branches:
    #   - "self-hosted"
  workflow_dispatch:

jobs:
  build-and-deploy:

    runs-on: self-hosted
    
    steps:
    - uses: actions/checkout@v3

    - name: Setup .NET Core
      uses: actions/setup-dotnet@v2
      with:
        dotnet-version: 6.0.300
    
    # dotnet build and publish
    - name: Build with dotnet
      run: dotnet build --configuration Release

    - name: dotnet publish 
      run: |
        dotnet publish -c Release -o dotnetcorewebapp

    - name: Deploy to IIS
      run: |
        iisreset /stop
        Copy-Item ./dotnetcorewebapp/* C:/inetpub/wwwroot/ -Recurse -Force
        iisreset /start
    
    # - name: Curl the website as a smoke test
    #   run: curl http://localhost/dotnetcore-webapp

    # - name: Run Web Test
    #   run: |
    #     dotnet build --configuration Release .\dotnet-core-webapp.webtest
    #     cd .\dotnet-core-webapp.webtests
    #     dotnet test

Last updated