Skip to content

Commit

Permalink
- Prep CI release process
Browse files Browse the repository at this point in the history
- Migrate release worker to Windows instead of Ubuntu
- Remove unused Unix scripts
  • Loading branch information
nwithan8 committed Nov 20, 2023
1 parent 9536387 commit a5d8845
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 296 deletions.
87 changes: 48 additions & 39 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Release

on:
workflow_dispatch: ~
pull_request: ~
push:
tags:
# ex. "v1.2.3", "v1.2.3-rc1"
Expand All @@ -9,7 +11,7 @@ on:
jobs:
publish:
name: Publish to NuGet
runs-on: ubuntu-22.04
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -26,48 +28,55 @@ jobs:
- name: Setup Nuget
uses: NuGet/[email protected]

- name: Load NuGet package cache
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ matrix.framework }}-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore NuGet Packages
run: make restore

- name: Set up dotnet tools and dependencies
run: make install

- name: Prep certificate imports
run: mkdir -p certs

- name: Import authenticity certificate
run: echo "${{ secrets.AUTHENTICITY_CERT_ENC }}" > certs/authenticity_cert.pfx.enc

- name: Import signing certificate
run: echo "${{ secrets.SIGNING_CERT_ENC }}" > cert/signing_cert.snk.enc

- name: Decrypt certificates
run: make github-actions-certs-decrypt pass=${{ secrets.ENCRYPTION_KEY }}

- name: Delete straggling .nupkg files
run: rm -f *.nupkg || true

- name: Build NuGet package
run: make prep-release cert=certs/authenticity_cert.pfx sncert=certs/signing_cert.snk pass=${{ secrets.CERT_PASSWORD }}

- name: Delete certificates
run: rm -rf certs

- name: Publish to NuGet
run: make publish key=${{ secrets.NUGET_API_KEY }}

- name: Create a GitHub release
uses: softprops/action-gh-release@v1
- name: Set up authenticity certificate
run: |
echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
shell: bash

- name: Set variables
id: variables
run: |
echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV"
echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV"
echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV"
echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH
echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH
echo "C:\Program Files\DigiCert\DigiCert Keylocker Tools" >> $GITHUB_PATH
shell: bash

- name: Setup Keylocker KSP on Windows
run: |
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
msiexec /i Keylockertools-windows-x64.msi /quiet /qn
smksp_registrar.exe list
smctl.exe keypair ls
C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user
shell: cmd

- name: Sync Certificates
run: |
smctl windows certsync
shell: cmd

- name: Build and Sign NuGet package
run: |
call scripts\win\build_release_nuget.bat EasyPost certs\signing_cert.snk "${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }}" Release
shell: cmd

# - name: Publish to NuGet
# run: make publish key=${{ secrets.NUGET_API_KEY }}

# - name: Create a GitHub release
# uses: softprops/action-gh-release@v1
# ref: https://github.com/softprops/action-gh-release#-customizing
with:
body_path: RELEASE_NOTES.md
files: |
"*.nupkg"
# with:
# body_path: RELEASE_NOTES.md
# files: |
# "*.nupkg"
4 changes: 2 additions & 2 deletions EasyPost.Integration/TestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ internal static string GetApiKey(ApiKey apiKey)
}

// ReSharper disable once InconsistentNaming
internal static Client GetBasicVCRClient(string apiKey, HttpClient? vcrClient = null) => new(new ClientConfiguration(apiKey)
internal static Client GetBasicVCRClient(string apiKey, System.Net.Http.HttpClient? vcrClient = null) => new(new ClientConfiguration(apiKey)
{
CustomHttpClient = vcrClient,
});
Expand Down Expand Up @@ -138,7 +138,7 @@ public VCR(string? testCassettesFolder = null, ApiKey apiKey = ApiKey.Test)

internal bool IsRecording() => _vcr.Mode == Mode.Record;

internal Client SetUpTest(string cassetteName, Func<string, HttpClient, Client> getClientFunc, string? overrideApiKey = null)
internal Client SetUpTest(string cassetteName, Func<string, System.Net.Http.HttpClient, Client> getClientFunc, string? overrideApiKey = null)
{
// override api key if needed
string apiKey = overrideApiKey ?? _apiKey;
Expand Down
8 changes: 0 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@ lint-fix:
lint-scripts:
scripts\win\lint_scripts.bat

## prep-release - Build, sign and package the project for distribution, signing with the provided certificate
# @parameters:
# sncert= - The strong-name certificate to use for signing the built assets.
# cert= - The authenticity certificate to use for signing the built assets.
# pass= - The password for the authenticity certificate.
prep-release:
bash scripts/unix/build_release_nuget.sh EasyPost ${sncert} ${cert} ${pass} Release

## publish - Publish the project to NuGet
# @parameters:
# key= - The NuGet API key to use for publishing.
Expand Down
13 changes: 0 additions & 13 deletions scripts/unix/build_project.sh

This file was deleted.

39 changes: 0 additions & 39 deletions scripts/unix/build_release_nuget.sh

This file was deleted.

8 changes: 0 additions & 8 deletions scripts/unix/delete_old_assemblies.sh

This file was deleted.

14 changes: 0 additions & 14 deletions scripts/unix/gpg_decrypt.sh

This file was deleted.

18 changes: 0 additions & 18 deletions scripts/unix/gpg_decrypt_dir.sh

This file was deleted.

14 changes: 0 additions & 14 deletions scripts/unix/gpg_encrypt.sh

This file was deleted.

16 changes: 0 additions & 16 deletions scripts/unix/gpg_encrypt_dir.sh

This file was deleted.

38 changes: 0 additions & 38 deletions scripts/unix/install_osslsigncode.sh

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/unix/pack_nuget.sh

This file was deleted.

23 changes: 0 additions & 23 deletions scripts/unix/sign_dlls.sh

This file was deleted.

22 changes: 0 additions & 22 deletions scripts/unix/sign_nuget.sh

This file was deleted.

20 changes: 0 additions & 20 deletions scripts/unix/strong_name_dlls.sh

This file was deleted.

Loading

0 comments on commit a5d8845

Please sign in to comment.