@@ -69,16 +69,67 @@ jobs:
6969 name : build-artifacts
7070 path : ${{ github.workspace }}/artifacts
7171
72+ sign :
73+ needs : build
74+ runs-on : windows-latest # Code signing must run on a Windows agent for Authenticode signing (dll/exe)
75+ environment : release # Needed for OIDC subject for releases triggered on release being created.
76+ permissions :
77+ id-token : write # Required for requesting the JWT
78+
79+ steps :
80+ - name : Download build artifacts
81+ uses : actions/download-artifact@v4
82+ with :
83+ name : build-artifacts
84+ path : ${{ github.workspace }}/build-artifacts
85+
86+ - name : Setup .NET
87+ uses : actions/setup-dotnet@v3
88+ with :
89+ dotnet-version : ' 9.x'
90+
91+ - name : Install Sign CLI tool
92+ run : dotnet tool install --tool-path . --prerelease sign
93+
94+ - name : ' Az CLI login'
95+ uses : azure/login@v2
96+ with :
97+ client-id : 80125de0-6f58-4f16-bd05-b2fa621d36a5
98+ tenant-id : 16076fdc-fcc1-4a15-b1ca-32c9a255900e
99+ allow-no-subscriptions : true
100+
101+ - name : Sign artifacts
102+ shell : pwsh
103+ run : >
104+ ./sign code azure-key-vault
105+ **/*.nupkg
106+ --base-directory "${{ github.workspace }}/build-artifacts/packages"
107+ --publisher-name "OpenAI"
108+ --description "OpenAI library for .NET"
109+ --description-url "https://github.com/openai/openai-dotnet"
110+ --azure-credential-type "azure-cli"
111+ --azure-key-vault-url "https://sc-openaisdk.vault.azure.net/"
112+ --azure-key-vault-certificate "OpenAISDKSCCert"
113+
114+ - name : Upload signed artifact
115+ uses : actions/upload-artifact@v4
116+ with :
117+ name : build-artifacts-signed
118+ path : ${{ github.workspace }}/build-artifacts
119+
72120 deploy :
73121 name : Publish Package
74- needs : build
122+ needs : sign
75123 runs-on : ubuntu-latest
76124 steps :
77125 - name : Checkout code
78126 uses : actions/checkout@v2
79127
80128 - name : Download build artifacts
81129 uses : actions/download-artifact@v4
130+ with :
131+ name : build-artifacts-signed
132+ path : ${{ github.workspace }}/build-artifacts
82133
83134 - name : Upload release asset
84135 if : github.event_name == 'release'
@@ -92,6 +143,13 @@ jobs:
92143 run : |
93144 gh release edit "${{ github.event.release.tag_name }}" \
94145 --notes "See full changelog: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.event.release.tag_name }}/CHANGELOG.md"
146+ env :
147+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
148+
149+ - name : Setup .NET
150+ uses : actions/setup-dotnet@v3
151+ with :
152+ dotnet-version : ' 9.x'
95153
96154 - name : NuGet authenticate
97155 run : dotnet nuget add source
@@ -114,4 +172,4 @@ jobs:
114172 ${{ github.workspace }}/build-artifacts/packages/*.nupkg
115173 --source https://api.nuget.org/v3/index.json
116174 --api-key ${{ secrets.NUGET_API_KEY }}
117- --skip-duplicate
175+ --skip-duplicate
0 commit comments