Skip to content

Commit 922cf9f

Browse files
umbynosper1234
andauthored
[skip changelog] Update notarization job, now usable with p12 cert format (#1062)
* update notarization job usable with p12 cert * Apply suggestions from code review Co-authored-by: per1234 <accounts@perglass.com> * update nightly.yaml to use p12 cert * replace third party action to handle keychain with shell code * revert to previous gon installation with homebrew tap is not possible to install an exact version of an app * forgot to modify step name Co-authored-by: per1234 <accounts@perglass.com>
1 parent 8bd0d0f commit 922cf9f

File tree

2 files changed

+44
-28
lines changed

2 files changed

+44
-28
lines changed

.github/workflows/nightly.yaml

+22-14
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,35 @@ jobs:
4646
with:
4747
name: dist
4848

49-
- name: Download Gon
49+
- name: Import Code-Signing Certificates
50+
env:
51+
KEYCHAIN: "sign.keychain"
52+
INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12"
53+
run: |
54+
echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > ${{ env.INSTALLER_CERT_MAC_PATH }}
55+
security create-keychain -p ${{ secrets.KEYCHAIN_PASSWORD }} ${{ env.KEYCHAIN }}
56+
security default-keychain -s ${{ env.KEYCHAIN }}
57+
security unlock-keychain -p ${{ secrets.KEYCHAIN_PASSWORD }} ${{ env.KEYCHAIN }}
58+
security import ${{ env.INSTALLER_CERT_MAC_PATH }} -k ${{ env.KEYCHAIN }} -f pkcs12 -A -T /usr/bin/codesign -P ${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}
59+
security set-key-partition-list -S apple-tool:,apple: -s -k ${{ secrets.KEYCHAIN_PASSWORD }} ${{ env.KEYCHAIN }}
60+
61+
- name: Install gon for code signing and app notarization
5062
run: |
51-
wget -q https://github.com/mitchellh/gon/releases/download/v0.2.2/gon_0.2.2_macos.zip
52-
unzip gon_0.2.2_macos.zip -d /usr/local/bin
53-
rm -f gon_0.2.2_macos.zip
63+
wget -q https://github.com/mitchellh/gon/releases/download/v0.2.3/gon_macos.zip
64+
unzip gon_macos.zip -d /usr/local/bin
5465
55-
- name: Notarize binary, re-package it and update checksum
66+
- name: Sign and notarize binary
5667
env:
5768
AC_USERNAME: ${{ secrets.AC_USERNAME }}
5869
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
59-
# This step performs the following:
60-
# 1. Download keychain from GH secrets and decode it from base64
61-
# 2. Add the keychain to the system keychains and unlock it
62-
# 3. Call Gon to start notarization process (using AC_USERNAME and AC_PASSWORD)
63-
# 4. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
64-
# 5. Recalculate package checksum and replace it in the goreleaser nnnnnn-checksums.txt file
6570
run: |
66-
echo "${{ secrets.KEYCHAIN }}" | base64 --decode > ~/Library/Keychains/apple-developer.keychain-db
67-
security list-keychains -s ~/Library/Keychains/apple-developer.keychain-db
68-
security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" ~/Library/Keychains/apple-developer.keychain-db
6971
gon gon.config.hcl
72+
73+
- name: Re-package binary and update checksum
74+
# This step performs the following:
75+
# 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
76+
# 2. Recalculate package checksum and replace it in the goreleaser nnnnnn-checksums.txt file
77+
run: |
7078
# GitHub's upload/download-artifact@v1 actions don't preserve file permissions,
7179
# so we need to add execution permission back until @v2 actions are released.
7280
chmod +x dist/arduino_cli_osx_darwin_amd64/arduino-cli

.github/workflows/release.yaml

+22-14
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,35 @@ jobs:
4141
with:
4242
name: dist
4343

44-
- name: Download Gon
44+
- name: Import Code-Signing Certificates
45+
env:
46+
KEYCHAIN: "sign.keychain"
47+
INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12"
48+
run: |
49+
echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > ${{ env.INSTALLER_CERT_MAC_PATH }}
50+
security create-keychain -p ${{ secrets.KEYCHAIN_PASSWORD }} ${{ env.KEYCHAIN }}
51+
security default-keychain -s ${{ env.KEYCHAIN }}
52+
security unlock-keychain -p ${{ secrets.KEYCHAIN_PASSWORD }} ${{ env.KEYCHAIN }}
53+
security import ${{ env.INSTALLER_CERT_MAC_PATH }} -k ${{ env.KEYCHAIN }} -f pkcs12 -A -T /usr/bin/codesign -P ${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}
54+
security set-key-partition-list -S apple-tool:,apple: -s -k ${{ secrets.KEYCHAIN_PASSWORD }} ${{ env.KEYCHAIN }}
55+
56+
- name: Install gon for code signing and app notarization
4557
run: |
46-
wget -q https://github.com/mitchellh/gon/releases/download/v0.2.2/gon_0.2.2_macos.zip
47-
unzip gon_0.2.2_macos.zip -d /usr/local/bin
48-
rm -f gon_0.2.2_macos.zip
58+
wget -q https://github.com/mitchellh/gon/releases/download/v0.2.3/gon_macos.zip
59+
unzip gon_macos.zip -d /usr/local/bin
4960
50-
- name: Notarize binary, re-package it and update checksum
61+
- name: Sign and notarize binary
5162
env:
5263
AC_USERNAME: ${{ secrets.AC_USERNAME }}
5364
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
54-
# This step performs the following:
55-
# 1. Download keychain from GH secrets and decode it from base64
56-
# 2. Add the keychain to the system keychains and unlock it
57-
# 3. Call Gon to start notarization process (using AC_USERNAME and AC_PASSWORD)
58-
# 4. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
59-
# 5. Recalculate package checksum and replace it in the goreleaser nnnnnn-checksums.txt file
6065
run: |
61-
echo "${{ secrets.KEYCHAIN }}" | base64 --decode > ~/Library/Keychains/apple-developer.keychain-db
62-
security list-keychains -s ~/Library/Keychains/apple-developer.keychain-db
63-
security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" ~/Library/Keychains/apple-developer.keychain-db
6466
gon gon.config.hcl
67+
68+
- name: Re-package binary and update checksum
69+
# This step performs the following:
70+
# 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
71+
# 2. Recalculate package checksum and replace it in the goreleaser nnnnnn-checksums.txt file
72+
run: |
6573
# GitHub's upload/download-artifact@v1 actions don't preserve file permissions,
6674
# so we need to add execution permission back until @v2 actions are released.
6775
chmod +x dist/arduino_cli_osx_darwin_amd64/arduino-cli

0 commit comments

Comments
 (0)