-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (72 loc) · 2.74 KB
/
dotnet.yml
File metadata and controls
85 lines (72 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: .NET
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Publish
run: dotnet publish NET6.WebAPI/NET6.WebAPI.csproj -c Release -o webapi
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.2.2
with:
name: webapi
path: webapi/**
if-no-files-found: error
deploy_stage:
needs: build
runs-on: windows-latest
env:
app_name: 'webapi'
app_pool_name: 'webapi-pool'
physical_path: 'C:\deployments\NET6-WebAPI'
IIS_WEBSITE_NAME: 'Default Web Site'
IIS_SERVER_COMPUTER_NAME: '139.180.144.223'
IIS_SERVER_USERNAME: 'Administrator'
IIS_SERVER_PASSWORD: '${{ secrets.IIS_SERVER_PASSWORD }}'
app_pool_user_service: 'webapi'
app_pool_password_service: 'Stage1Testing'
source_physical_path: 'C:\deployments\'
environment:
name: Stage
steps:
- name: Download a Build Artifact
id: download
uses: actions/download-artifact@v3
with:
name: webapi
# path: '${{ env.physical-path }}'
- name: Copy files to the Remote Computer
shell: powershell
run: |
$so = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck
[System.Security.SecureString]$SecurePassword = ConvertTo-SecureString "${{ env.IIS_SERVER_PASSWORD }}" -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "${{ env.IIS_SERVER_USERNAME }}", $SecurePassword
$userSession = New-PSSession -ComputerName "${{ env.IIS_SERVER_COMPUTER_NAME }}" -Credential $credential -UseSSL -SessionOption $so
Copy-Item "${{steps.download.outputs.download-path}}\" -Destination "${{ env.source_physical_path }}" -ToSession $userSession -Recurse -Force
- name: Deploy WebAPI with PowerShell
uses: nhatthai/iis-webapp@v0.1.1
with:
server: '${{ env.IIS_SERVER_COMPUTER_NAME }}'
app_name: '${{ env.app_name }}'
app_pool_name: '${{ env.app_pool_name }}'
physical_path: '${{ env.physical_path }}'
deploy_user_id: '${{ env.IIS_SERVER_USERNAME }}'
deploy_user_secret: '${{ env.IIS_SERVER_PASSWORD }}'
website_name: '${{ env.IIS_WEBSITE_NAME }}'
app_pool_user_service: '${{ env.app_pool_user_service }}'
app_pool_password_service: '${{ env.app_pool_password_service }}'