|
| 1 | +name: Manually build release-ready NuGet package |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: ~ |
| 5 | + |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + name: Build Release-Ready NuGet Package |
| 9 | + runs-on: windows-latest |
| 10 | + steps: |
| 11 | + - name: Checkout repository |
| 12 | + uses: actions/checkout@v4 |
| 13 | + |
| 14 | + - name: Install .NET SDK |
| 15 | + uses: actions/setup-dotnet@v3 |
| 16 | + with: |
| 17 | + # .NET 5 is deprecated and removed from GitHub Actions, we need to manually install it |
| 18 | + dotnet-version: | |
| 19 | + 5.x.x |
| 20 | + 8.x.x |
| 21 | +
|
| 22 | + - name: Setup Nuget |
| 23 | + |
| 24 | + |
| 25 | + - name: Restore NuGet Packages |
| 26 | + run: make restore |
| 27 | + |
| 28 | + - name: Set up dotnet tools and dependencies |
| 29 | + run: make install |
| 30 | + |
| 31 | + - name: Set up authenticity certificate |
| 32 | + run: | |
| 33 | + echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12 |
| 34 | + shell: bash |
| 35 | + |
| 36 | + - name: Set variables |
| 37 | + id: variables |
| 38 | + run: | |
| 39 | + echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV" |
| 40 | + echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV" |
| 41 | + echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV" |
| 42 | + echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV" |
| 43 | + echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH |
| 44 | + echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH |
| 45 | + echo "C:\Program Files\DigiCert\DigiCert Keylocker Tools" >> $GITHUB_PATH |
| 46 | + shell: bash |
| 47 | + |
| 48 | + - name: Setup Keylocker KSP on Windows |
| 49 | + run: | |
| 50 | + 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 |
| 51 | + msiexec /i Keylockertools-windows-x64.msi /quiet /qn |
| 52 | + smksp_registrar.exe list |
| 53 | + smctl.exe keypair ls |
| 54 | + C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user |
| 55 | + shell: cmd |
| 56 | + |
| 57 | + - name: Sync Certificates |
| 58 | + run: | |
| 59 | + smctl windows certsync |
| 60 | + shell: cmd |
| 61 | + |
| 62 | + - name: Build and Sign NuGet package |
| 63 | + run: | |
| 64 | + call scripts\win\build_release_nuget.bat EasyPost EasyPostNETStrongNameSigning.snk "${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }}" Release |
| 65 | + shell: cmd |
| 66 | + |
| 67 | + - name: Upload NuGet package to Action output |
| 68 | + uses: actions/upload-artifact@v4 |
| 69 | + with: |
| 70 | + path: "*.nupkg" |
0 commit comments