Skip to content

Commit

Permalink
KSM .NET SDK: GHA to publish strong named binary:
Browse files Browse the repository at this point in the history
- updated copyright year to 2024
- updated to the publish.nuget.strong.named.yml
- updates to the publish.nuget.yml
  • Loading branch information
maksimu committed Mar 27, 2024
1 parent e75f576 commit b6402b1
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/test.publish.nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,22 @@ jobs:
run: |
$snPath = "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe"
$snkPath = "${{ github.workspace }}\sdk\dotNet\SecretsManager\sgKSM.snk"
$publicKeyInfo = & $snPath -Tp $snkPath
$publicKey = $publicKeyInfo | Select-String "Public Key:" -Context 0, 1 | ForEach-Object { $_.Context.PostContext[0] }
$publicKey = $publicKey -replace "\s", "" # Remove any whitespace from the public key string
$publicKeyPath = "${{ github.workspace }}\sdk\dotNet\SecretsManager\sgKSM.pub"
& $snPath -p $snkPath $publicKeyPath
$publicKeyInfo = & $snPath -tp $publicKeyPath
Write-Output "Public Key Info: START"
Write-Output "$publicKeyInfo"
Write-Output "Public Key Info: END"
# Extract the full public key
$publicKey = $publicKeyInfo -split "`n" | Where-Object { $_ -match "^[a-f0-9]{32}$" } -join ""
if (-not $publicKey) {
Write-Error "Failed to extract the full public key."
exit 1
}
Write-Output "Extracted Public Key: $publicKey"
$filePath = "${{ github.workspace }}\sdk\dotNet\SecretsManager\SecretsManagerClient.cs"
(Get-Content $filePath) -replace '\[assembly: InternalsVisibleTo\("SecretsManager.Test.Core"\)\]', "[assembly: InternalsVisibleTo(`"SecretsManager.Test.Core, PublicKey=$publicKey`")]" | Set-Content $filePath
Write-Output "First 20 lines of the modified SecretsManagerClient.cs:"
Expand All @@ -64,10 +77,6 @@ jobs:
Copy-Item -Path "${{ github.workspace }}\sdk\dotNet\SecretsManager\sgKSM.snk" -Destination "${{ github.workspace }}\sdk\dotNet\SecretsManager.Test.Core\sgKSM.snk"
Get-ChildItem "${{ github.workspace }}\sdk\dotNet\SecretsManager.Test.Core\"
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3

- name: Build
working-directory: ${{ github.workspace }}\sdk\dotNet\SecretsManager\
run: |
Expand All @@ -91,3 +100,8 @@ jobs:
run: |
Get-ChildItem ".\bin\Release\"
dotnet nuget push ".\bin\Release\*.nupkg" --api-key ${{steps.ksmsecrets.outputs.NUGET_AUTH_TOKEN}} --source https://api.nuget.org/v3/index.json
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3

0 comments on commit b6402b1

Please sign in to comment.