From 89527fdd39451d345b1fc490744984b58842aa78 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Tue, 19 May 2026 11:36:55 +0200 Subject: [PATCH 1/2] ref(ci): change update-package-sha.sh to use loop approach --- scripts/update-package-sha.sh | 49 +++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/scripts/update-package-sha.sh b/scripts/update-package-sha.sh index 0589971be4..91a4220284 100755 --- a/scripts/update-package-sha.sh +++ b/scripts/update-package-sha.sh @@ -17,30 +17,39 @@ if [ -z "$PACKAGE_FILES" ]; then exit 1 fi -NEW_CHECKSUM_STATIC=$(shasum -a 256 XCFrameworkBuildPath/Sentry.xcframework.zip | awk '{print $1}') -NEW_CHECKSUM_DYNAMIC=$(shasum -a 256 XCFrameworkBuildPath/Sentry-Dynamic.xcframework.zip | awk '{print $1}') -NEW_CHECKSUM_DYNAMIC_WITH_ARM64E=$(shasum -a 256 XCFrameworkBuildPath/Sentry-Dynamic-WithARM64e.xcframework.zip | awk '{print $1}') -NEW_CHECKSUM_WITHOUT_UIKIT_OR_APPKIT=$(shasum -a 256 XCFrameworkBuildPath/Sentry-WithoutUIKitOrAppKit.xcframework.zip | awk '{print $1}') -NEW_CHECKSUM_WITHOUT_UIKIT_OR_APPKIT_WITH_ARM64E=$(shasum -a 256 XCFrameworkBuildPath/Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework.zip | awk '{print $1}') +# Each entry pairs the xcframework zip filename with the comment marker used +# in Package.swift (e.g. `checksum: "…" //Sentry-Static`). Specific markers +# (e.g. `-WithARM64e`) must come after their prefix markers so the broader +# substitution runs first and the specific one overrides it. +ZIPS_AND_MARKERS=( + "Sentry.xcframework.zip|Sentry-Static" + "Sentry-Dynamic.xcframework.zip|Sentry-Dynamic" + "Sentry-Dynamic-WithARM64e.xcframework.zip|Sentry-Dynamic-WithARM64e" + "Sentry-WithoutUIKitOrAppKit.xcframework.zip|Sentry-WithoutUIKitOrAppKit" + "Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework.zip|Sentry-WithoutUIKitOrAppKit-WithARM64e" +) os=$(uname) +# Craft pre-release command runs on an ubuntu machine +# and `sed` needs an extra argument for macOS. +if [ "$os" == "Linux" ]; then + sed_inplace=( -i ) +else + sed_inplace=( -i "" ) +fi for package_file in $PACKAGE_FILES; do - # Craft pre-release command runs on an ubuntu machine - # and `sed` needs an extra argument for macOS - if [ "$os" == "Linux" ]; then - sed -i "s/checksum: \".*\" \/\/Sentry-Static/checksum: \"$NEW_CHECKSUM_STATIC\" \/\/Sentry-Static/" "$package_file" - sed -i "s/checksum: \".*\" \/\/Sentry-Dynamic/checksum: \"$NEW_CHECKSUM_DYNAMIC\" \/\/Sentry-Dynamic/" "$package_file" - sed -i "s/checksum: \".*\" \/\/Sentry-Dynamic-WithARM64e/checksum: \"$NEW_CHECKSUM_DYNAMIC_WITH_ARM64E\" \/\/Sentry-Dynamic-WithARM64e/" "$package_file" - sed -i "s/checksum: \".*\" \/\/Sentry-WithoutUIKitOrAppKit/checksum: \"$NEW_CHECKSUM_WITHOUT_UIKIT_OR_APPKIT\" \/\/Sentry-WithoutUIKitOrAppKit/" "$package_file" - sed -i "s/checksum: \".*\" \/\/Sentry-WithoutUIKitOrAppKit-WithARM64e/checksum: \"$NEW_CHECKSUM_WITHOUT_UIKIT_OR_APPKIT_WITH_ARM64E\" \/\/Sentry-WithoutUIKitOrAppKit-WithARM64e/" "$package_file" - else - sed -i "" "s/checksum: \".*\" \/\/Sentry-Static/checksum: \"$NEW_CHECKSUM_STATIC\" \/\/Sentry-Static/" "$package_file" - sed -i "" "s/checksum: \".*\" \/\/Sentry-Dynamic/checksum: \"$NEW_CHECKSUM_DYNAMIC\" \/\/Sentry-Dynamic/" "$package_file" - sed -i "" "s/checksum: \".*\" \/\/Sentry-Dynamic-WithARM64e/checksum: \"$NEW_CHECKSUM_DYNAMIC_WITH_ARM64E\" \/\/Sentry-Dynamic-WithARM64e/" "$package_file" - sed -i "" "s/checksum: \".*\" \/\/Sentry-WithoutUIKitOrAppKit/checksum: \"$NEW_CHECKSUM_WITHOUT_UIKIT_OR_APPKIT\" \/\/Sentry-WithoutUIKitOrAppKit/" "$package_file" - sed -i "" "s/checksum: \".*\" \/\/Sentry-WithoutUIKitOrAppKit-WithARM64e/checksum: \"$NEW_CHECKSUM_WITHOUT_UIKIT_OR_APPKIT_WITH_ARM64E\" \/\/Sentry-WithoutUIKitOrAppKit-WithARM64e/" "$package_file" - fi + for entry in "${ZIPS_AND_MARKERS[@]}"; do + zip="${entry%%|*}" + marker="${entry##*|}" + zip_path="XCFrameworkBuildPath/${zip}" + if [ ! -f "$zip_path" ]; then + echo "::warning::Skipping ${marker}: ${zip_path} not found" + continue + fi + checksum=$(shasum -a 256 "$zip_path" | awk '{print $1}') + sed "${sed_inplace[@]}" "s/checksum: \".*\" \/\/${marker}/checksum: \"${checksum}\" \/\/${marker}/" "$package_file" + done done echo "$GITHUB_RUN_ID" > .github/last-release-runid From a5c96748b24a3fa5a0d3b71bc12a77960fa973fe Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Tue, 19 May 2026 11:49:31 +0200 Subject: [PATCH 2/2] fix(ci): fail on missing zip files in update-package-sha --- scripts/update-package-sha.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/update-package-sha.sh b/scripts/update-package-sha.sh index 91a4220284..7ca0e556b0 100755 --- a/scripts/update-package-sha.sh +++ b/scripts/update-package-sha.sh @@ -44,8 +44,8 @@ for package_file in $PACKAGE_FILES; do marker="${entry##*|}" zip_path="XCFrameworkBuildPath/${zip}" if [ ! -f "$zip_path" ]; then - echo "::warning::Skipping ${marker}: ${zip_path} not found" - continue + log_error "Missing ${marker}: ${zip_path} not found" + exit 1 fi checksum=$(shasum -a 256 "$zip_path" | awk '{print $1}') sed "${sed_inplace[@]}" "s/checksum: \".*\" \/\/${marker}/checksum: \"${checksum}\" \/\/${marker}/" "$package_file"