Vijay Pratap Singh

Vijay Pratap Singh

  • 325
  • 5.1k
  • 468.3k

GitHub Action id not creating publish folder and not updating dll's.

Jun 27 2023 6:19 AM
name: ASP.NET Core Web API Deploy

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v2

    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 6.0.x  # or the version you're using

    - name: Build and publish
      run: dotnet publish -c Release -o ./publish

    - name: Stop IIS Website
      run: |
        Import-Module WebAdministration
        Stop-WebSite -Name "practicecicdgithub" -ErrorAction SilentlyContinue

    - name: Deploy to IIS
      run: |
        $publishFolder = "${{ github.workspace }}/publish"
        $siteName = "practicecicdgithub"
        $destinationFolder = "D:\PublishPracticeAPIs"

        # Copy published files to the target folder
        Copy-Item -Path $publishFolder -Destination $destinationFolder -Recurse -Force

        # Import the WebAdministration module
        Import-Module WebAdministration

          # Create a new website
          New-WebApplication -Name $siteName -Site 'Default Web Site' -PhysicalPath 
          $destinationFolder
    - name: Recycle application pool
      run: |
         $appPoolName = "DefaultAppPool"  # Replace with the name of your application pool
         Invoke-Command -ScriptBlock { Import-Module WebAdministration; Restart-WebAppPool -Name 
        $args[0] } -ArgumentList $appPoolName

I have successfully built the pipeline in GitHub actions, which is also building successfully on each push in the master branch. But these above commands are not making publish folder and neither can I get DLLs. It means this is working fine but my code is not getting updated on the success build.

 

 


Answers (2)