|
51 | 51 | - name: Setup Poetry |
52 | 52 | if: steps.cached-poetry.outputs.cache-hit != 'true' |
53 | 53 | uses: snok/install-poetry@v1 |
| 54 | + with: |
| 55 | + version: 1.5.1 |
54 | 56 |
|
55 | 57 | - name: Add Poetry to PATH |
56 | 58 | run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
@@ -108,10 +110,51 @@ jobs: |
108 | 110 | # we can't staple the app because it's executable. we should only staple app bundles like .dmg |
109 | 111 | # xcrun stapler staple dist/cycode |
110 | 112 |
|
111 | | - - name: Test signed executable |
| 113 | + - name: Test macOS signed executable |
112 | 114 | if: ${{ startsWith(matrix.os, 'macos') }} |
113 | 115 | run: ./dist/cycode version |
114 | 116 |
|
| 117 | + - name: Import cert for Windows and setup envs |
| 118 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 119 | + env: |
| 120 | + SM_CLIENT_CERT_FILE_B64: ${{ secrets.SM_CLIENT_CERT_FILE_B64 }} |
| 121 | + run: | |
| 122 | + # import certificate |
| 123 | + echo "$SM_CLIENT_CERT_FILE_B64" | base64 --decode > /d/Certificate_pkcs12.p12 |
| 124 | + echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV" |
| 125 | +
|
| 126 | + # add required soft to the path |
| 127 | + echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH |
| 128 | + echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH |
| 129 | +
|
| 130 | + - name: Sign Windows executable |
| 131 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 132 | + shell: cmd |
| 133 | + env: |
| 134 | + SM_HOST: ${{ secrets.SM_HOST }} |
| 135 | + SM_API_KEY: ${{ secrets.SM_API_KEY }} |
| 136 | + SM_CLIENT_CERT_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }} |
| 137 | + SM_CODE_SIGNING_CERT_SHA1_HASH: ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }} |
| 138 | + run: | |
| 139 | + :: setup SSM KSP |
| 140 | + curl -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools-windows-x64.msi |
| 141 | + msiexec /i smtools-windows-x64.msi /quiet /qn |
| 142 | + C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user |
| 143 | + smksp_cert_sync.exe |
| 144 | +
|
| 145 | + :: sign executable |
| 146 | + signtool.exe sign /sha1 %SM_CODE_SIGNING_CERT_SHA1_HASH% /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 ".\dist\cycode.exe" |
| 147 | +
|
| 148 | + - name: Test Windows signed executable |
| 149 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 150 | + shell: cmd |
| 151 | + run: | |
| 152 | + :: call executable and expect correct output |
| 153 | + .\dist\cycode.exe version |
| 154 | +
|
| 155 | + :: verify signature |
| 156 | + signtool.exe verify /v /pa ".\dist\cycode.exe" |
| 157 | +
|
115 | 158 | - uses: actions/upload-artifact@v3 |
116 | 159 | with: |
117 | 160 | name: cycode-cli-${{ matrix.os }} |
|
0 commit comments