Reputation: 53
`name: DEEEEDeploy to Development Environment on: push: branches: - master pull_request: branches: - PrepRod env:
AZURE_DEVWEBAPP_NAME: GitAc-Dev AZURE_PREPRODWEBAPP_NAME: GitAc-PreProd AZURE_WEBAPP_PACKAGE_PATH: 'D:\a\GitNewTest2\GitNewTest2\GitNewTest2\bin' jobs: Build: runs-on: windows-latest steps: - uses: actions/checkout@v2
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Setup NuGet
uses: NuGet/[email protected]
- name: Restore NuGet packages
run: nuget restore GitNewTest2/GitNewTest2.sln
- name: build
run: |
msbuild GitNewTest2/GitNewTest2.sln /t:Build /p:Configuration=Release /p:Platform="Any CPU" /verbosity:minimal
- name: publish
run: |
msbuild GitNewTest2/GitNewTest2.sln /t:Publish /p:Configuration=Release /p:Platform="Any CPU" /p:PublishDir="./artifacts"
name: Upload artifacts uses: actions/upload-artifact@v2 with: name: myapp path: ${{env.AZURE_WEBAPP_PACKAGE_PATH}}
name: running1 run: | Get-location
name: running6 run: | dir D:\a\GitNewTest2\GitNewTest2\GitNewTest2\bin
name: Download artifacts uses: actions/download-artifact@v2 with: name: myapp path: 'C:\app.publish'
name: running run: | Get-location
name: running2 run: | dir
name: running3 run: | cd C:\app.publish dir
DeployDev:
name: Dev
needs: Build
# if: github.event_name == 'refs/heads/master'
runs-on: self-hosted
env:
DEV_WEBSITE_NAME: ${{secrets.DEV_WEBSITE_NAME}}
DEV_APP_POOL_NAME: ${{secrets.DEV_APP_POOL_NAME}}
WEBAPP_MSDeploy_USERNAME: ${{secrets.IIS_USERNAME}}
WEBAPP_MSDeploy_PASSWORD: ${{secrets.IIS_PASSWORD}}
environment:
name: Dev
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: myapp
path: 'C:\app.publish'
- name: copying
run: |
$path="${{github.workspace}}\GitNewTest2\Scripts\DevTestScript.ps1"
echo $path
& $path
cd C:\inetpub\wwwroot\
dir
Copy-Item C:\app.publish\* C:\inetpub\wwwroot\${{env.DEV_WEBSITE_NAME}} -Recurse -Force
name: create new apppool run: |
Start-Process powershell.exe -Verb RunAs -ArgumentList "-File C:\actions-runner\_work\GitNewTest2\GitNewTest2\GitNewTest2\Scripts\DevTestAppPool.ps1"
# & C:\actions-runner\_work\GitNewTest2\GitNewTest2\GitNewTest2\Scripts\DevTestAppPool.ps1
- name: create website
run: |
& C:\actions-runner\_work\GitNewTest2\GitNewTest2\GitNewTest2\Scripts\DevTestWebsite.ps1
- name: config to use new appool
run: |
Set-ItemProperty -Path "IIS:\Sites\${{env.DEV_WEBSITE_NAME}}" -Name "applicationPool" -Value ${{env.DEV_APP_POOL_NAME}}
- name: Deploy to IIS
run: |
start-process PowerShell -verb runas
iisreset /stop
iisreset /start
`
Above I shared my github workflow code , I have tried with command RunAs , then tried editing registry policy as well. Stil I see the same error . Any help would be greate.
Upvotes: 0
Views: 2061
Reputation: 54
I am using self hosted GitHub action and this happens to me:
I was struggling with this as I have this error when I am trying to make the pool sleep and then start it and the privilege causes it
Run Stop-WebAppPool -Name "DotNetTesting"
Process should have elevated status to access IIS configuration data.
stop-webitem : Cannot find drive. A drive with the name 'IIS' does not exist.
I solved it by going to the action runner and trying to run "run.cmd" as an administrator and solved.
Upvotes: 0