Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ on: [push]
env:
BuildParameters.RestoreBuildProjects: '**/*.csproj'
BuildParameters.TestProjects: '**/*[Tt]ests/*.csproj'

# Nuget Feed Credentials
TEL_GITHUB_DEVOPS_USERNAME: ${{ secrets.TEL_GITHUB_DEVOPS_USERNAME }}
TEL_GITHUB_PACKAGE_READ_PAT: ${{ secrets.TEL_GITHUB_PACKAGE_READ_PAT }}
TEL_AZURE_DEVOPS_USERNAME: ${{ secrets.TEL_AZURE_DEVOPS_USERNAME }}
TEL_AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }}
jobs:
build:
name: Build and test
Expand All @@ -15,10 +21,45 @@ jobs:
with:
dotnet-version: 8.0.x

- name: Add Azure artifact
# Todo: remove check once all pipeline work and have the file
- name: Check if nuget.config.cicd exists
id: check_nuget_cicd
run: |
if (Test-Path "nuget.config.cicd") {
echo "exists=true" >> $env:GITHUB_OUTPUT
echo "nuget.config.cicd exists"
} else {
echo "exists=false" >> $env:GITHUB_OUTPUT
echo "nuget.config.cicd doesnt exist"
}
shell: pwsh

# Remove local nuget.config (Should be gitignored) and create nuget.config from nuget.config.cicd
# Todo: remove if once all pipeline work and have the file
- name: Setup NuGet with CICD config
if: steps.check_nuget_cicd.outputs.exists == 'true'
run: |
if (Test-Path "nuget.config") { Remove-Item "nuget.config" }
Copy-Item "nuget.config.cicd" "nuget.config"
shell: pwsh

# Replace env values with github secrets
- name: Replace environment variables in nuget config
if: steps.check_nuget_cicd.outputs.exists == 'true'
run: |
(Get-Content nuget.config) -replace '%TEL_GITHUB_DEVOPS_USERNAME%', $env:TEL_GITHUB_DEVOPS_USERNAME | Set-Content nuget.config
(Get-Content nuget.config) -replace '%TEL_GITHUB_PACKAGE_READ_PAT%', $env:TEL_GITHUB_PACKAGE_READ_PAT | Set-Content nuget.config
(Get-Content nuget.config) -replace '%TEL_AZURE_DEVOPS_USERNAME%', $env:TEL_AZURE_DEVOPS_USERNAME | Set-Content nuget.config
(Get-Content nuget.config) -replace '%TEL_AZURE_DEVOPS_PAT%', $env:TEL_AZURE_DEVOPS_PAT | Set-Content nuget.config
shell: pwsh

# Todo: remove fallback once all pipeline work and have the file
- name: Setup NuGet with Azure DevOps (fallback)
if: steps.check_nuget_cicd.outputs.exists == 'false'
run: |
dotnet nuget remove source LearningHubFeed || true
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
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


- name: Use Node 14
uses: actions/setup-node@v4
Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,13 @@ obj
/AdminUI/LearningHub.Nhs.AdminUI/web.config
/LearningHub.Nhs.WebUI/web.config
/WebAPI/LearningHub.Nhs.API/web.config
/.github/workflows/test.yml
/LearningHub.Nhs.WebUI.BlazorClient/Properties/launchSettings.json
/LearningHub.Nhs.WebUI.slnLaunch.user
/LearningHub.Nhs.WebUI.BlazorClient/LearningHub.Nhs.WebUI.BlazorClient.csproj.user
/LearningHub.Nhs.WebUI.BlazorClient/wwwroot/appsettings.Development.json
/nuget.config
/LearningHub.Nhs.WebUI.slnLaunch.user
/LearningHub.Nhs.WebUI.BlazorClient/LearningHub.Nhs.WebUI.BlazorClient.csproj.user
/LearningHub.Nhs.WebUI.BlazorClient/wwwroot/appsettings.Development.json
/LearningHub.Nhs.WebUI.BlazorClient/Properties/launchSettings.json
57 changes: 57 additions & 0 deletions nuget.config.cicd
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- using environmental variables:
* for cicd sed replace environmental variables
-->
<packageSources>
<!--Clean and just use these sources-->
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="TELGitNugetFeed" value="https://nuget.pkg.github.com/TechnologyEnhancedLearning/index.json" />
<add key="TELAzureLearningHubNugetFeed" value="https://pkgs.dev.azure.com/e-LfH/_packaging/LearningHubFeed/nuget/v3/index.json" />
</packageSources>

<packageSourceCredentials>
<TELGitNugetFeed>
<add key="Username" value="%TEL_GITHUB_DEVOPS_USERNAME%" />
<!--cleartext for benefit of github actions-->
<add key="ClearTextPassword" value="%TEL_GITHUB_PACKAGE_READ_PAT%" />
</TELGitNugetFeed>

<TELAzureLearningHubNugetFeed>
<add key="Username" value="%TEL_AZURE_DEVOPS_USERNAME%" />
<!--cleartext for benefit of github actions-->
<add key="ClearTextPassword" value="%TEL_AZURE_DEVOPS_PAT%" />
</TELAzureLearningHubNugetFeed>
</packageSourceCredentials>

<!--Use local package first if not found use remote-->
<!--<packageSource key="TELLocalNugetFeed">
<package pattern="*" />
</packageSource>-->

<packageSourceMapping>
<packageSource key="TELGitNugetFeed">
<package pattern="TELBlazor.*" />
<package pattern="NHSETELViewComponents" />
<!-- Best practice to only apply all to one source but we may want to enable it for convenience (and we do duplicate some packages across both sources) -->
<!-- <package pattern="*" /> -->
</packageSource>

<packageSource key="TELAzureLearningHubNugetFeed">
<package pattern="LearningHub.Nhs.*" />
<package pattern="elfhHub.Nhs.*" />
<package pattern="GDS.MultiPageFormData" />
<package pattern="NHSUKSearchSortFilterPaginate" />
<package pattern="NHSUKViewComponents.Web" />
<package pattern="UK.NHS.CookieBanner" />
<!-- Best practice to only apply all to one source but we may want to enable it for convenience (and we do duplicate some packages across both sources) -->
<!-- <package pattern="*" /> -->
</packageSource>

<!--Check official nuget last-->
<packageSource key="nuget.org">
<package pattern="*" />
</packageSource>
</packageSourceMapping>
</configuration>
59 changes: 59 additions & 0 deletions nuget.config.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- using environmental variables:
* for cicd sed replace environmental variables
-->
<packageSources>
<!--Clean and just use these sources-->
<clear />
<!--Local at the top so can override remote feeds-->
<!--<add key="TELLocalNugetFeed" value="%TEL_LOCAL_FEED%" />-->
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="TELGitNugetFeed" value="https://nuget.pkg.github.com/TechnologyEnhancedLearning/index.json" />
<add key="TELAzureLearningHubNugetFeed" value="https://pkgs.dev.azure.com/e-LfH/_packaging/LearningHubFeed/nuget/v3/index.json" />
</packageSources>

<packageSourceCredentials>
<TELGitNugetFeed>
<add key="Username" value="%TEL_GITHUB_DEVOPS_USERNAME%" />
<!--cleartext for benefit of github actions-->
<add key="ClearTextPassword" value="%TEL_GITHUB_PACKAGE_READ_PAT%" />
</TELGitNugetFeed>

<TELAzureLearningHubNugetFeed>
<add key="Username" value="%TEL_AZURE_DEVOPS_USERNAME%" />
<!--cleartext for benefit of github actions-->
<add key="ClearTextPassword" value="%TEL_AZURE_DEVOPS_PAT%" />
</TELAzureLearningHubNugetFeed>
</packageSourceCredentials>

<!--Use local package first if not found use remote-->
<!--<packageSource key="TELLocalNugetFeed">
<package pattern="*" />
</packageSource>-->

<packageSourceMapping>
<packageSource key="TELGitNugetFeed">
<package pattern="TELBlazor.*" />
<package pattern="NHSETELViewComponents" />
<!-- Best practice to only apply all to one source but we may want to enable it for convenience (and we do duplicate some packages across both sources) -->
<!-- <package pattern="*" /> -->
</packageSource>

<packageSource key="TELAzureLearningHubNugetFeed">
<package pattern="LearningHub.Nhs.*" />
<package pattern="elfhHub.Nhs.*" />
<package pattern="GDS.MultiPageFormData" />
<package pattern="NHSUKSearchSortFilterPaginate" />
<package pattern="NHSUKViewComponents.Web" />
<package pattern="UK.NHS.CookieBanner" />
<!-- Best practice to only apply all to one source but we may want to enable it for convenience (and we do duplicate some packages across both sources) -->
<!-- <package pattern="*" /> -->
</packageSource>

<!--Check official nuget last-->
<packageSource key="nuget.org">
<package pattern="*" />
</packageSource>
</packageSourceMapping>
</configuration>
Loading