6363 - name : Set up Docker Buildx
6464 uses : docker/setup-buildx-action@v4
6565
66+ - name : Generate NuGet auth config for Docker build
67+ if : github.event_name != 'pull_request' && github.event_name != 'merge_group'
68+ env :
69+ NUGET_AUTH_TOKEN : ${{ secrets.AZURE_DEVOPS_PAT }}
70+ run : |
71+ cat > /tmp/nuget-auth.config << EOF
72+ <?xml version="1.0" encoding="utf-8"?>
73+ <configuration>
74+ <packageSources>
75+ <clear />
76+ <add key="nuget" value="https://api.nuget.org/v3/index.json" />
77+ <add key="EssentialCSharp" value="https://pkgs.dev.azure.com/intelliTect/_packaging/EssentialCSharp/nuget/v3/index.json" />
78+ </packageSources>
79+ <packageSourceCredentials>
80+ <EssentialCSharp>
81+ <add key="Username" value="docker" />
82+ <add key="ClearTextPassword" value="${NUGET_AUTH_TOKEN}" />
83+ </EssentialCSharp>
84+ </packageSourceCredentials>
85+ </configuration>
86+ EOF
87+
6688# Build but no push with a PR
6789 - name : Docker build (no push)
6890 if : github.event_name == 'pull_request' || github.event_name == 'merge_group'
7193 push : false
7294 tags : temp-pr-validation
7395 file : ./EssentialCSharp.Web/Dockerfile
96+ context : .
97+ build-args : ACCESS_TO_NUGET_FEED=false
7498
7599 - name : Build Container Image
76100 if : github.event_name != 'pull_request_target' && github.event_name != 'pull_request'
80104 file : ./EssentialCSharp.Web/Dockerfile
81105 context : .
82106 secrets : |
83- "nuget_auth_token=${{ secrets.AZURE_DEVOPS_PAT }} "
107+ "id=nugetconfig,src=/tmp/nuget-auth.config "
84108 outputs : type=docker,dest=${{ github.workspace }}/essentialcsharpwebimage.tar
85109 cache-from : type=gha
86110 cache-to : type=gha,mode=max
@@ -90,6 +114,10 @@ jobs:
90114 name : essentialcsharpwebimage
91115 path : ${{ github.workspace }}/essentialcsharpwebimage.tar
92116
117+ - name : Clean up NuGet auth config
118+ if : always()
119+ run : rm -f /tmp/nuget-auth.config
120+
93121 deploy-development :
94122 if : github.event_name != 'pull_request_target' && github.event_name != 'pull_request'
95123 runs-on : ubuntu-latest
0 commit comments