|
9 | 9 | runs-on: windows-latest |
10 | 10 | steps: |
11 | 11 | - uses: actions/checkout@v3 |
12 | | - |
13 | | - - name: Modify web.config files in all apps |
14 | | - shell: pwsh |
15 | | - run: | |
16 | | - $webConfigPaths = @( |
17 | | - "${{ github.workspace }}\AdminUI\LearningHub.Nhs.AdminUI\web.config", |
18 | | - "${{ github.workspace }}\WebAPI\LearningHub.Nhs.Api\web.config", |
19 | | - "${{ github.workspace }}\LearningHub.Nhs.WebUI\web.config" |
20 | | - ) |
21 | | -
|
22 | | - foreach ($path in $webConfigPaths) { |
23 | | - if (Test-Path $path) { |
24 | | - Write-Host "Modifying $path" |
25 | | - [xml]$config = Get-Content $path |
26 | | - |
27 | | - if (-not $config.configuration.'system.webServer') { |
28 | | - $systemWebServer = $config.CreateElement("system.webServer") |
29 | | - $config.configuration.AppendChild($systemWebServer) | Out-Null |
30 | | - } else { |
31 | | - $systemWebServer = $config.configuration.'system.webServer' |
32 | | - } |
33 | | - |
34 | | - if (-not $systemWebServer.httpProtocol) { |
35 | | - $httpProtocol = $config.CreateElement("httpProtocol") |
36 | | - $systemWebServer.AppendChild($httpProtocol) | Out-Null |
37 | | - } else { |
38 | | - $httpProtocol = $systemWebServer.httpProtocol |
39 | | - } |
40 | | - |
41 | | - if (-not $httpProtocol.customHeaders) { |
42 | | - $customHeaders = $config.CreateElement("customHeaders") |
43 | | - $httpProtocol.AppendChild($customHeaders) | Out-Null |
44 | | - } else { |
45 | | - $customHeaders = $httpProtocol.customHeaders |
46 | | - } |
47 | | - |
48 | | - foreach ($name in @("X-Powered-By", "Server")) { |
49 | | - $removeNode = $config.CreateElement("remove") |
50 | | - $removeNode.SetAttribute("name", $name) |
51 | | - $customHeaders.AppendChild($removeNode) | Out-Null |
52 | | - } |
53 | | - |
54 | | - if (-not $systemWebServer.security) { |
55 | | - $security = $config.CreateElement("security") |
56 | | - $systemWebServer.AppendChild($security) | Out-Null |
57 | | - } else { |
58 | | - $security = $systemWebServer.security |
59 | | - } |
60 | | - |
61 | | - if (-not $security.requestFiltering) { |
62 | | - $requestFiltering = $config.CreateElement("requestFiltering") |
63 | | - $requestFiltering.SetAttribute("removeServerHeader", "true") |
64 | | - $security.AppendChild($requestFiltering) | Out-Null |
65 | | - } |
66 | | - |
67 | | - $config.Save($path) |
68 | | - } else { |
69 | | - Write-Host "File not found: $path" |
70 | | - } |
71 | | - } |
72 | | - |
73 | 12 | - name: Setup .NET Core SDK 8.0 |
74 | 13 | uses: actions/setup-dotnet@v3 |
75 | 14 | with: |
76 | 15 | dotnet-version: 8.0.x |
77 | | - |
78 | 16 | - name: Add Azure artifact |
79 | 17 | run: dotnet nuget add source 'https://pkgs.dev.azure.com/e-LfH/_packaging/LearningHubFeed/nuget/v3/index.json' --name 'LearningHubFeed' --username 'kevin.whittaker' --password ${{ secrets.AZURE_DEVOPS_PAT }} --store-password-in-clear-text |
80 | 18 |
|
|
0 commit comments