@@ -40,38 +40,15 @@ jobs:
40
40
run : make test-docker release
41
41
- run : bash <(curl -s https://codecov.io/bash)
42
42
43
- import-certificate :
44
- runs-on : windows-latest
45
- steps :
46
- - uses : actions/checkout@v2
47
- - run : make install
48
- - name : import-certificate
49
- run : |
50
- New-Item -ItemType directory -Path certificate
51
- Set-Content -Path certificate\certificate.txt -Value '${{ secrets.CODE_SIGNING_CERTIFICATE }}'
52
- certutil -decode certificate\certificate.txt certificate\certificate.pfx
53
-
54
- - name : Upload Artifact
55
- uses : actions/upload-artifact@v3
56
- with :
57
- name : certificate.pfx
58
- path : certificate\certificate.pfx
59
- retention-days : 1
60
-
61
43
deploy :
62
44
name : Deploy
63
45
if : success() && github.ref_type == 'tag'
64
- needs : [ test, import-certificate ]
46
+ needs : [ test ]
65
47
runs-on : ubuntu-latest
66
48
steps :
67
49
- name : Checkout sendgrid-csharp
68
50
uses : actions/checkout@v2
69
51
70
- - name : Download code signing certificate
71
- uses : actions/download-artifact@v3
72
- with :
73
- name : certificate.pfx
74
-
75
52
- name : Setup .NET Core SDK
76
53
uses : actions/setup-dotnet@v3
77
54
with :
@@ -84,16 +61,74 @@ jobs:
84
61
env :
85
62
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
86
63
87
- - name : Publish package to NuGet
88
- run : |
89
- make release
90
- dotnet nuget sign **/*.nupkg --certificate-path certificate.pfx --certificate-password ${{ secrets.CERTIFICATE_PASSWORD }} --timestamper http://timestamp.digicert.com
91
- dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
92
-
93
64
- name : Submit metric to Datadog
94
65
uses : sendgrid/dx-automator/actions/datadog-release-metric@main
95
66
env :
96
67
DD_API_KEY : ${{ secrets.DATADOG_API_KEY }}
68
+
69
+ code-signing :
70
+ runs-on : windows-latest
71
+ needs : [ deploy ]
72
+ steps :
73
+ - name : Checkout sendgrid-csharp
74
+ uses : actions/checkout@v2
75
+
76
+ - name : Setup .NET Core SDK
77
+ uses : actions/setup-dotnet@v3
78
+ with :
79
+ dotnet-version : ' 3.1.x'
80
+
81
+ - name : Set up certificate
82
+ run : |
83
+ echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
84
+ shell : bash
85
+
86
+ - name : Set variables
87
+ id : variables
88
+ run : |
89
+ dir
90
+ echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
91
+ echo "::set-output name=KEYPAIR_NAME::gt-standard-keypair"
92
+ echo "::set-output name=CERTIFICATE_NAME::gt-certificate"
93
+ echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV"
94
+ echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV"
95
+ echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
96
+ echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV"
97
+ echo "BUILD_TOOLS_VERSION=31.0.0" >> "$GITHUB_ENV"
98
+ echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH
99
+ echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH
100
+ echo "C:\Program Files\DigiCert\DigiCert Keylocker Tools" >> $GITHUB_PATH
101
+ shell : bash
102
+
103
+ - name : Code signing with Software Trust Manager
104
+ id : SSMClientToolSetup
105
+
106
+ env :
107
+ SM_API_KEY : ${{ env.SM_API_KEY }}
108
+ SM_CLIENT_CERT_PASSWORD : ${{ env.SM_CLIENT_CERT_PASSWORD }}
109
+ SM_CLIENT_CERT_FILE : ${{ env.SM_CLIENT_CERT_FILE }}
110
+
111
+ - run : echo “The config file path ${{ steps.SSMClientToolSetup.outputs.PKCS11_CONFIG }}”
112
+
113
+ - name : Setup Keylocker KSP on windows
114
+ run : |
115
+ curl -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/Keylockertools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o Keylockertools-windows-x64.msi
116
+ msiexec /i Keylockertools-windows-x64.msi /quiet /qn
117
+ smksp_registrar.exe list
118
+ smctl.exe keypair ls
119
+ C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user
120
+ shell : cmd
121
+
122
+ - name : Certificates Sync
123
+ run : |
124
+ smctl windows certsync
125
+ shell : cmd
126
+
127
+ - name : Signing using Nuget
128
+ run : |
129
+ dotnet pack -c Release
130
+ nuget sign **/*.nupkg -Timestamper http://timestamp.digicert.com -outputdirectory .\NugetSigned -CertificateFingerprint ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }} -HashAlgorithm SHA256 -Verbosity detailed -Overwrite
131
+ nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
97
132
98
133
notify-on-failure :
99
134
name : Slack notify on failure
0 commit comments