Skip to content

Commit

Permalink
Do not include full path to binary in .sha512 files on darwin
Browse files Browse the repository at this point in the history
See ipfs/kubo#9323.

This is a darwin release thing because the signature process for macOS means
that we recalculate sha512 and cid and we do this using an absolute path so
the result includes the path to the file.

The fix is to cd to the folder and do it from there.
  • Loading branch information
hsanjuan committed Nov 8, 2024
1 parent 1499621 commit 6f36628
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/ci/sign-new-macos-releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,20 @@ echo "::group::Update changed binaries in ./releases"
echo "-> Updating $PKG_NAME"
rm "$PKG_PATH"
tar -czvf "${WORK_DIR}/releases/${DIST_NAME}/${DIST_VERSION}/$PKG_NAME" -C "${WORK_DIR}/tmp/${DIST_NAME}_${DIST_VERSION}_${arch}-signed/" "${DIST_NAME}"
pushd "${PKG_ROOT}"
# calculate new hashes
NEW_CID=$(ipfs add -Qn "$PKG_PATH")
NEW_SHA512_LINE=$(gsha512sum "$PKG_PATH")
NEW_CID=$(ipfs add -Qn "$PKG_NAME")
NEW_SHA512_LINE=$(gsha512sum "$PKG_NAME")
NEW_SHA512=$(echo "$NEW_SHA512_LINE" | gawk '{ print $1; }')
echo "-> New $PKG_NAME"
echo " new CID: $NEW_CID"
echo " new SHA512: $NEW_SHA512"
# update metadata to use new hashes
echo "$NEW_CID" > "${PKG_PATH}.cid"
echo "$NEW_SHA512_LINE" > "${PKG_PATH}.sha512"
gsed -i "s/${OLD_CID}/${NEW_CID}/g; s/${OLD_SHA512}/${NEW_SHA512}/g" "${PKG_ROOT}/dist.json"
echo "$NEW_CID" > "${PKG_NAME}.cid"
echo "$NEW_SHA512_LINE" > "${PKG_NAME}.sha512"
gsed -i "s/${OLD_CID}/${NEW_CID}/g; s/${OLD_SHA512}/${NEW_SHA512}/g" "dist.json"
echo "-> Completed the update of ${arch}.tar.gz for ${DIST_NAME} ${DIST_VERSION}"
popd
done
done
echo "::endgroup::"

0 comments on commit 6f36628

Please sign in to comment.