@@ -46,29 +46,65 @@ jobs:
46
46
dotnet tool install --global dotnet-sonarscanner --version 5.5.3
47
47
make cover
48
48
49
- import-certificate :
49
+ code-signing :
50
50
runs-on : windows-latest
51
51
steps :
52
- - uses : actions/checkout@v2
53
- - run : make install
54
- - name : import-certificate
55
- run : |
56
- New-Item -ItemType directory -Path certificate
57
- Set-Content -Path certificate\certificate.txt -Value '${{ secrets.CODE_SIGNING_CERTIFICATE }}'
58
- certutil -decode certificate\certificate.txt certificate\certificate.pfx
59
-
60
- - name : Upload Artifact
61
- uses : actions/upload-artifact@v3
62
- with :
63
- name : certificate.pfx
64
- path : certificate\certificate.pfx
65
- retention-days : 1
52
+ - name : Set up certificate
53
+ run : |
54
+ echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
55
+ cat /d/Certificate_pkcs12.p12
56
+ shell : bash
57
+
58
+ - name : Set variables
59
+ id : variables
60
+ run : |
61
+ dir
62
+ echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
63
+ echo "::set-output name=KEYPAIR_NAME::gt-standard-keypair"
64
+ echo "::set-output name=CERTIFICATE_NAME::gt-certificate"
65
+ echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV"
66
+ echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV"
67
+ echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
68
+ echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV"
69
+ echo "BUILD_TOOLS_VERSION=31.0.0" >> "$GITHUB_ENV"
70
+ echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH
71
+ echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH
72
+ echo "C:\Program Files\DigiCert\DigiCert Keylocker Tools" >> $GITHUB_PATH
73
+ shell : bash
74
+
75
+ - name : Code signing with Software Trust Manager
76
+ id : SSMClientToolSetup
77
+ uses : digicert/ssm-code-signing@v0.0.2
78
+ env :
79
+ SM_API_KEY : ${{ env.SM_API_KEY }}
80
+ SM_CLIENT_CERT_PASSWORD : ${{ env.SM_CLIENT_CERT_PASSWORD }}
81
+ SM_CLIENT_CERT_FILE : ${{ env.SM_CLIENT_CERT_FILE }}
66
82
83
+ - run : echo “The config file path ${{ steps.SSMClientToolSetup.outputs.PKCS11_CONFIG }}”
84
+
85
+ - name : Setup Keylocker KSP on windows
86
+ run : |
87
+ 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
88
+ msiexec /i Keylockertools-windows-x64.msi /quiet /qn
89
+ smksp_registrar.exe list
90
+ smctl.exe keypair ls
91
+ C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user
92
+ shell : cmd
93
+
94
+ - name : Certificates Sync
95
+ run : |
96
+ smctl windows certsync
97
+ shell : cmd
98
+
99
+ - name : Create Signed Directory
100
+ run : |
101
+ mkdir D:\a\stm-github-action-demo\stm-github-action-demo\dist\
102
+ shell : cmd
67
103
68
104
deploy :
69
105
name : Deploy
70
106
if : success() && github.ref_type == 'tag'
71
- needs : [ test, import-certificate ]
107
+ needs : [ test, code-signing ]
72
108
runs-on : ubuntu-latest
73
109
steps :
74
110
- name : Checkout twilio-csharp
@@ -106,11 +142,18 @@ jobs:
106
142
- name : Build and Push image
107
143
run : make docker-build docker-push
108
144
145
+ - name : NuGet Install
146
+ uses : NuGet/setup-nuget@v1.0.5
147
+ with :
148
+ nuget-version : latest
149
+
109
150
- name : Publish package to NuGet
110
151
run : |
111
152
make release
112
- dotnet nuget sign **/*.nupkg --certificate-path certificate.pfx --certificate-password ${{ secrets.CERTIFICATE_PASSWORD }} --timestamper http://timestamp.digicert.com
113
- dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
153
+ copy D:\a\stm-github-action-demo\stm-github-action-demo\UNSIGNED.nupkg D:\a\stm-github-action-demo\stm-github-action-demo\dist\UNSIGNED.nupkg
154
+ nuget sign "D:\a\stm-github-action-demo\stm-github-action-demo\dist\UNSIGNED.nupkg" -Timestamper http://timestamp.digicert.com -outputdirectory "D:\a\stm-github-action-demo\stm-github-action-demo\dist\NugetSigned" -CertificateFingerprint ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }} -HashAlgorithm SHA256 -Verbosity detailed -Overwrite
155
+ nuget verify -All "D:\a\stm-github-action-demo\stm-github-action-demo\dist\NugetSigned\*"
156
+ nuget push "D:\a\stm-github-action-demo\stm-github-action-demo\dist\UNSIGNED.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
114
157
115
158
- name : Submit metric to Datadog
116
159
uses : sendgrid/dx-automator/actions/datadog-release-metric@main
0 commit comments