| 1 | #!/bin/bash |
| 2 | # Complete Sniffly Release Process |
| 3 | # Creates both ZIP (for Homebrew cask) and DMG (for manual download) |
| 4 | |
| 5 | set -e # Exit on error (except where we explicitly handle it) |
| 6 | |
| 7 | GREEN='\033[0;32m' |
| 8 | BLUE='\033[0;34m' |
| 9 | YELLOW='\033[1;33m' |
| 10 | NC='\033[0m' |
| 11 | |
| 12 | VERSION=$(cat VERSION) |
| 13 | |
| 14 | echo -e "${BLUE}========================================${NC}" |
| 15 | echo -e "${BLUE} Sniffly Release Builder v${VERSION}${NC}" |
| 16 | echo -e "${BLUE}========================================${NC}" |
| 17 | echo "" |
| 18 | |
| 19 | # Step 1: Build release binary |
| 20 | echo -e "${BLUE}Step 1: Building release binary...${NC}" |
| 21 | meson setup build --buildtype=release --wipe || meson setup build --buildtype=release |
| 22 | meson compile -C build |
| 23 | echo -e "${GREEN}✓ Binary built${NC}" |
| 24 | echo "" |
| 25 | |
| 26 | # Step 2: Create .app bundle |
| 27 | echo -e "${BLUE}Step 2: Creating .app bundle...${NC}" |
| 28 | # Allow the packaging script to fail (library bundling may hit Mach-O header limits) |
| 29 | ./scripts/package-macos-fixed.sh || echo -e "${YELLOW}Warning: Packaging had some issues, continuing anyway...${NC}" |
| 30 | |
| 31 | # Re-sign the app to fix any signature issues |
| 32 | echo -e "${BLUE}Re-signing app bundle...${NC}" |
| 33 | codesign --force --deep --sign - Sniffly.app 2>&1 || echo "Signing warnings (can be ignored)" |
| 34 | echo -e "${GREEN}✓ App bundle created${NC}" |
| 35 | echo "" |
| 36 | |
| 37 | # Step 3: Create DMG for manual download |
| 38 | echo -e "${BLUE}Step 3: Creating DMG for manual download...${NC}" |
| 39 | DMG_NAME="Sniffly-${VERSION}-macOS.dmg" |
| 40 | DMG_TEMP="dmg_temp" |
| 41 | rm -rf "${DMG_TEMP}" "${DMG_NAME}" |
| 42 | mkdir -p "${DMG_TEMP}" |
| 43 | cp -r Sniffly.app "${DMG_TEMP}/" |
| 44 | ln -s /Applications "${DMG_TEMP}/Applications" |
| 45 | hdiutil create -volname "Sniffly" -srcfolder "${DMG_TEMP}" -ov -format UDZO "${DMG_NAME}" |
| 46 | rm -rf "${DMG_TEMP}" |
| 47 | DMG_SIZE=$(du -h "${DMG_NAME}" | cut -f1) |
| 48 | echo -e "${GREEN}✓ DMG created: ${DMG_NAME} (${DMG_SIZE})${NC}" |
| 49 | echo "" |
| 50 | |
| 51 | # Step 4: Create ZIP for Homebrew cask |
| 52 | echo -e "${BLUE}Step 4: Creating ZIP for Homebrew cask...${NC}" |
| 53 | ZIP_NAME="Sniffly-${VERSION}-macOS.zip" |
| 54 | rm -f "${ZIP_NAME}" |
| 55 | ditto -c -k --sequesterRsrc --keepParent Sniffly.app "${ZIP_NAME}" |
| 56 | ZIP_SIZE=$(du -h "${ZIP_NAME}" | cut -f1) |
| 57 | echo -e "${GREEN}✓ ZIP created: ${ZIP_NAME} (${ZIP_SIZE})${NC}" |
| 58 | echo "" |
| 59 | |
| 60 | # Step 5: Calculate SHA256 for cask |
| 61 | echo -e "${BLUE}Step 5: Calculating SHA256 for Homebrew cask...${NC}" |
| 62 | SHA256=$(shasum -a 256 "${ZIP_NAME}" | awk '{print $1}') |
| 63 | echo -e "${GREEN}SHA256: ${SHA256}${NC}" |
| 64 | echo "" |
| 65 | |
| 66 | # Summary |
| 67 | DMG_NAME="Sniffly-${VERSION}-macOS.dmg" |
| 68 | DMG_SIZE=$(du -h "${DMG_NAME}" | cut -f1) |
| 69 | |
| 70 | echo -e "${GREEN}========================================${NC}" |
| 71 | echo -e "${GREEN} Release ${VERSION} Ready!${NC}" |
| 72 | echo -e "${GREEN}========================================${NC}" |
| 73 | echo "" |
| 74 | echo -e "${BLUE}Files created:${NC}" |
| 75 | echo -e " 1. ${ZIP_NAME} (${ZIP_SIZE}) - For Homebrew cask" |
| 76 | echo -e " 2. ${DMG_NAME} (${DMG_SIZE}) - For manual download" |
| 77 | echo "" |
| 78 | echo -e "${BLUE}Next steps:${NC}" |
| 79 | echo -e " 1. Create GitHub release: https://github.com/FortranGoingOnForty/sniffly/releases/new" |
| 80 | echo -e " 2. Tag: v${VERSION}" |
| 81 | echo -e " 3. Upload BOTH files: ${ZIP_NAME} and ${DMG_NAME}" |
| 82 | echo -e " 4. Update cask file with:" |
| 83 | echo "" |
| 84 | echo -e "${YELLOW} version \"${VERSION}\"${NC}" |
| 85 | echo -e "${YELLOW} sha256 \"${SHA256}\"${NC}" |
| 86 | echo "" |
| 87 | echo -e " 5. Commit and push cask changes" |
| 88 | echo "" |