Skip to content

Commit 09b3d07

Browse files
committed
TD-5930: ci yml
1 parent a4976ba commit 09b3d07

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ on: [push]
33
env:
44
BuildParameters.RestoreBuildProjects: '**/*.csproj'
55
BuildParameters.TestProjects: '**/*[Tt]ests/*.csproj'
6+
7+
# Nuget Feed Credentials
8+
TEL_GITHUB_DEVOPS_USERNAME: ${{ secrets.TEL_GITHUB_DEVOPS_USERNAME }}
9+
TEL_GITHUB_PACKAGE_READ_PAT: ${{ secrets.TEL_GITHUB_PACKAGE_READ_PAT }}
10+
TEL_AZURE_DEVOPS_USERNAME: ${{ secrets.TEL_AZURE_DEVOPS_USERNAME }}
11+
TEL_AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }}
612
jobs:
713
build:
814
name: Build and test
@@ -15,10 +21,45 @@ jobs:
1521
with:
1622
dotnet-version: 8.0.x
1723

18-
- name: Add Azure artifact
24+
# Todo: remove check once all pipeline work and have the file
25+
- name: Check if nuget.config.cicd exists
26+
id: check_nuget_cicd
27+
run: |
28+
if (Test-Path "nuget.config.cicd") {
29+
echo "exists=true" >> $env:GITHUB_OUTPUT
30+
echo "nuget.config.cicd exists"
31+
} else {
32+
echo "exists=false" >> $env:GITHUB_OUTPUT
33+
echo "nuget.config.cicd doesnt exist"
34+
}
35+
shell: pwsh
36+
37+
# Remove local nuget.config (Should be gitignored) and create nuget.config from nuget.config.cicd
38+
# Todo: remove if once all pipeline work and have the file
39+
- name: Setup NuGet with CICD config
40+
if: steps.check_nuget_cicd.outputs.exists == 'true'
41+
run: |
42+
if (Test-Path "nuget.config") { Remove-Item "nuget.config" }
43+
Copy-Item "nuget.config.cicd" "nuget.config"
44+
shell: pwsh
45+
46+
# Replace env values with github secrets
47+
- name: Replace environment variables in nuget config
48+
if: steps.check_nuget_cicd.outputs.exists == 'true'
49+
run: |
50+
(Get-Content nuget.config) -replace '%TEL_GITHUB_DEVOPS_USERNAME%', $env:TEL_GITHUB_DEVOPS_USERNAME | Set-Content nuget.config
51+
(Get-Content nuget.config) -replace '%TEL_GITHUB_PACKAGE_READ_PAT%', $env:TEL_GITHUB_PACKAGE_READ_PAT | Set-Content nuget.config
52+
(Get-Content nuget.config) -replace '%TEL_AZURE_DEVOPS_USERNAME%', $env:TEL_AZURE_DEVOPS_USERNAME | Set-Content nuget.config
53+
(Get-Content nuget.config) -replace '%TEL_AZURE_DEVOPS_PAT%', $env:TEL_AZURE_DEVOPS_PAT | Set-Content nuget.config
54+
shell: pwsh
55+
56+
# Todo: remove fallback once all pipeline work and have the file
57+
- name: Setup NuGet with Azure DevOps (fallback)
58+
if: steps.check_nuget_cicd.outputs.exists == 'false'
1959
run: |
2060
dotnet nuget remove source LearningHubFeed || true
21-
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
61+
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
62+
2263
2364
- name: Use Node 14
2465
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)