Skip to content

Commit

Permalink
Migrated to the new signing tool
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasherceg committed Jul 13, 2023
1 parent 5b892a9 commit f7d6df3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 26 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/publish-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,7 @@ jobs:

- name: Set up
uses: ./.github/setup

- name: Prepare signclient config
if: ${{ inputs.signature-type == 'DotNetFoundation' }}
run: Write-Output "$env:SIGN_CONFIG" | Out-File "${{ github.workspace }}/signconfig.json"
env:
SIGN_CONFIG: ${{ secrets.SIGN_CONFIG }}
working-directory: ${{ github.workspace }}/src


- name: Add internal NuGet feed
run: ./ci/scripts/Add-InternalNuGetFeed.ps1 `
-internalFeed "${{ secrets.AZURE_ARTIFACTS_FEED }}" `
Expand All @@ -92,8 +85,11 @@ jobs:
-root "${{ github.workspace }}" `
-version "${{ needs.read-input.outputs.version }}" `
-signatureType "DotNetFoundation" `
-dnfUser "${{ secrets.SIGN_USER }}" `
-dnfSecret "${{ secrets.SIGN_SECRET }}"
-dnfUrl "${{ secrets.SIGN_DNF_KEYVAULT_URL }}" `
-dnfClientId "${{ secrets.SIGN_DNF_CLIENT_ID }}" `
-dnfTenantId "${{ secrets.SIGN_DNF_TENANT_ID }}" `
-dnfSecret "${{ secrets.SIGN_DNF_SECRET }}" `
-dnfCertificate "${{ secrets.SIGN_DNF_CERTIFICATE_NAME }}"

- name: Publish NuGet packages (Riganti)
if: ${{ inputs.signature-type == 'Riganti' }}
Expand Down
29 changes: 19 additions & 10 deletions ci/scripts/Publish-NuGetPackages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ param(
[string][parameter(Mandatory = $true)]$version,
[string]$internalFeedName = "riganti",
[string]$signatureType = "DotNetFoundation",
[string]$dnfUser,
[string]$dnfUrl,
[string]$dnfClientId,
[string]$dnfTenantId,
[string]$dnfSecret,
[string]$dnfCertificate,
[string]$rigantiUrl,
[string]$rigantiClientId,
[string]$rigantiTenantId,
Expand All @@ -15,8 +18,12 @@ param(
$root = Resolve-Path "$root"

if ("$signatureType" -eq "DotNetFoundation") {
if (([string]::IsNullOrEmpty($dnfUser) -or [string]::IsNullOrEmpty($dnfSecret))) {
throw "-dnfUser and -dnfSecret are required when signing using signclient"
if ([string]::IsNullOrEmpty($dnfUrl) `
-or [string]::IsNullOrEmpty($dnfClientId) `
-or [string]::IsNullOrEmpty($dnfTenantId) `
-or [string]::IsNullOrEmpty($dnfSecret) `
-or [string]::IsNullOrEmpty($dnfCertificate)) {
throw "-dnfUrl, -dnfClientId, -dnfTenantId, -dnfSecret, and -dnfCertificate when signing using dotnet sign"
}
} elseif ("$signatureType" -eq "Riganti") {
if ([string]::IsNullOrEmpty($rigantiUrl) `
Expand Down Expand Up @@ -80,15 +87,17 @@ function Set-AllPackageSignatures {
$packageName = [System.IO.Path]::GetFileNameWithoutExtension($package);

if ($signatureType -eq "DotNetFoundation") {
dotnet signclient sign `
dotnet sign code azure-key-vault `
"$package" `
--baseDirectory "$root/artifacts/packages" `
--input "$package" `
--config "$root/signconfig.json" `
--user "$dnfUser" `
--secret "$dnfSecret" `
--name "$packageName" `
--publisher-name "DotVVM"
--description "$("$packageName" + " " + $env:DOTVVM_VERSION)" `
--descriptionUrl "https://github.com/riganti/dotvvm"
--descriptionUrl "https://github.com/riganti/dotvvm" `
--azure-key-vault-url "$dnfUrl" `
--azure-key-vault-client-id "$dnfClientId" `
--azure-key-vault-tenant-id "$dnfTenantId" `
--azure-key-vault-client-secret "$dnfSecret" `
--azure-key-vault-certificate "$dnfCertificate"
}
elseif ($signatureType -eq "Riganti") {
dotnet NuGetKeyVaultSignTool sign `
Expand Down
12 changes: 6 additions & 6 deletions src/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"version": 1,
"isRoot": true,
"tools": {
"signclient": {
"version": "1.2.33",
"commands": [
"SignClient"
]
},
"nugetkeyvaultsigntool": {
"version": "3.2.3",
"commands": [
"NuGetKeyVaultSignTool"
]
},
"sign": {
"version": "0.9.1-beta.23356.1",
"commands": [
"sign"
]
}
}
}

0 comments on commit f7d6df3

Please sign in to comment.