Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Switch to use a zip instead of a DMG
Browse files Browse the repository at this point in the history
Signed-off-by: tylerslaton <mtslaton1@gmail.com>
  • Loading branch information
tylerslaton committed Jul 3, 2023
1 parent db41f16 commit 7e7a519
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions tools/notarize
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ cd $(dirname $0)/..

BINARY="$1"
DIR="releases/mac_darwin_all"
DMG="releases/$2.dmg"
ZIP="releases/$2.zip"
CHECKSUMS="releases/checksums.txt"

if [[ -z "${NOTARIZE}" && "${GITHUB_REF}" =~ "refs/tags/v" ]]; then
echo "Enabling notarize..."
NOTARIZE="1"
fi

echo "NOTARIZE=${NOTARIZE} BUNDLE=${AC_BUNDLE} BINARY=${BINARY} DMG=${DMG}"
echo "NOTARIZE=${NOTARIZE} BUNDLE=${AC_BUNDLE} BINARY=${BINARY} ZIP=${ZIP}"

sudo apt-get update -y

Expand All @@ -44,21 +44,15 @@ rcodesign sign \
echo "Signed ${BINARY}!"

if [[ "${NOTARIZE}" == "1" ]]; then
which mkfs.hfsplus || sudo apt-get install hfsprogs -y
which zip || sudo apt-get install zip -y

# Build the DMG
echo "Building ${DMG}..."
# Zip everything up
echo "Building ${ZIP}..."
cp LICENSE README.md "${DIR}/"
SIZE="$(du -sm "${DIR}" | awk '{print $1 + 30}')" # The size of the directory + 30 megabytes for any overhead
dd if=/dev/zero of="${DMG}" bs=1M count="${SIZE}"
mkfs.hfsplus -v "Acorn" "${DMG}"
mkdir -p /tmp/acorn_mount
sudo mount -t hfsplus -o loop "${DMG}" /tmp/acorn_mount
sudo cp -R "${DIR}"/* /tmp/acorn_mount
sudo umount /tmp/acorn_mount
echo "Built ${DMG}!"

# Notarize and staple the DMG
zip -r "${ZIP}" "${DIR}"
echo "Built ${ZIP}!"

# Notarize the ZIP
echo "Building app-store-connect-api-key..."
echo "${AC_PRIVATE_KEY}" | base64 --decode > private.p8
rcodesign encode-app-store-connect-api-key \
Expand All @@ -68,14 +62,14 @@ if [[ "${NOTARIZE}" == "1" ]]; then
private.p8
echo "Built app-store-connect-api-key!"

echo "Notarizing and stapling ${DMG}..."
rcodesign notary-submit --api-key-path ./key.json "${DMG}" --staple
echo "${DMG} has been notarized and stapled!"
echo "Notarizing ${ZIP}..."
rcodesign notary-submit --api-key-path ./key.json "${ZIP}"
echo "Notarized ${ZIP}!"

# Add the sha256sum of the DMG to the checksums file
echo "Adding ${DMG}'s checksum to the checksums file..."
sha256sum "${DMG}" >> "${CHECKSUMS}"
echo "Added ${DMG}'s checksums!"
# Add the sha256sum of the ZIP to the checksums file
echo "Adding ${ZIP}'s checksum to the checksums file..."
sha256sum "${ZIP}" >> "${CHECKSUMS}"
echo "Added ${ZIP}'s checksums!"

else
echo "Skipping notarizing & disk image creation"
Expand Down

0 comments on commit 7e7a519

Please sign in to comment.