@@ -395,7 +395,7 @@ jobs:
395395
396396 echo "🍾 Creating Homebrew bottles for version $VERSION"
397397
398- # Determine macOS version for bottle tag (e.g., arm64_monterey, monterey)
398+ # Determine macOS version for bottle tag
399399 MACOS_VERSION=$(sw_vers -productVersion | cut -d '.' -f 1)
400400 case $MACOS_VERSION in
401401 12) MACOS_TAG="monterey" ;;
@@ -405,89 +405,72 @@ jobs:
405405 *) MACOS_TAG="monterey" ;; # Default fallback
406406 esac
407407
408- # Detect current architecture
409- ARCH=$(uname -m)
410- if [ "$ARCH" = "arm64" ]; then
411- BOTTLE_TAG="arm64_${MACOS_TAG}"
412- BINARY_PATH="./artifacts/ten-second-tom-osx-arm64/tom"
413- CHECKSUM_PATH="./artifacts/ten-second-tom-osx-arm64/checksum.txt"
414- else
415- BOTTLE_TAG="${MACOS_TAG}"
416- BINARY_PATH="./artifacts/ten-second-tom-osx-x64/tom"
417- CHECKSUM_PATH="./artifacts/ten-second-tom-osx-x64/checksum.txt"
418- fi
408+ echo "📦 Building bottles for macOS $MACOS_TAG (both architectures)"
419409
420- echo "📦 Building bottle for $BOTTLE_TAG"
410+ # Create ARM64 bottle
411+ BOTTLE_TAG_ARM64="arm64_${MACOS_TAG}"
412+ BOTTLE_NAME_ARM64="ten-second-tom--${VERSION}.${BOTTLE_TAG_ARM64}.bottle.tar.gz"
413+ BOTTLE_DIR_ARM64="ten-second-tom/${VERSION}/bin"
421414
422- # Create bottle directory structure
423- BOTTLE_DIR="ten-second-tom/${VERSION}/bin"
424- mkdir -p "$BOTTLE_DIR"
415+ mkdir -p "$BOTTLE_DIR_ARM64"
416+ cp "./artifacts/ten-second-tom-osx-arm64/tom" "$BOTTLE_DIR_ARM64/tom"
417+ chmod +x "$BOTTLE_DIR_ARM64/tom"
418+ tar czf "$BOTTLE_NAME_ARM64" ten-second-tom
425419
426- # Copy binary
427- cp "$BINARY_PATH" "$BOTTLE_DIR/tom "
428- chmod +x "$BOTTLE_DIR/tom "
420+ BOTTLE_SHA_ARM64=$(shasum -a 256 "$BOTTLE_NAME_ARM64" | cut -d ' ' -f 1)
421+ echo "✅ ARM64 bottle: $BOTTLE_NAME_ARM64 "
422+ echo " SHA256: $BOTTLE_SHA_ARM64 "
429423
430- # Create bottle tarball
431- BOTTLE_NAME="ten-second-tom--${VERSION}.${BOTTLE_TAG}.bottle.tar.gz"
432- tar czf "$BOTTLE_NAME" -C . ten-second-tom
424+ # Clean up for x64 bottle
425+ rm -rf ten-second-tom
433426
434- # Calculate bottle SHA256
435- BOTTLE_SHA=$(shasum -a 256 "$BOTTLE_NAME" | cut -d ' ' -f 1)
427+ # Create x64 bottle
428+ BOTTLE_TAG_X64="${MACOS_TAG}"
429+ BOTTLE_NAME_X64="ten-second-tom--${VERSION}.${BOTTLE_TAG_X64}.bottle.tar.gz"
430+ BOTTLE_DIR_X64="ten-second-tom/${VERSION}/bin"
436431
437- echo "✅ Bottle created: $BOTTLE_NAME"
438- echo " SHA256: $BOTTLE_SHA"
432+ mkdir -p "$BOTTLE_DIR_X64"
433+ cp "./artifacts/ten-second-tom-osx-x64/tom" "$BOTTLE_DIR_X64/tom"
434+ chmod +x "$BOTTLE_DIR_X64/tom"
435+ tar czf "$BOTTLE_NAME_X64" ten-second-tom
436+
437+ BOTTLE_SHA_X64=$(shasum -a 256 "$BOTTLE_NAME_X64" | cut -d ' ' -f 1)
438+ echo "✅ x64 bottle: $BOTTLE_NAME_X64"
439+ echo " SHA256: $BOTTLE_SHA_X64"
439440
440441 # Output variables for later steps
441- echo "bottle-name=$BOTTLE_NAME" >> $GITHUB_OUTPUT
442- echo "bottle-tag=$BOTTLE_TAG" >> $GITHUB_OUTPUT
443- echo "bottle-sha=$BOTTLE_SHA" >> $GITHUB_OUTPUT
444-
445- # Calculate checksums for both architectures directly from binaries
446- SHA256_X64=$(shasum -a 256 ./artifacts/ten-second-tom-osx-x64/tom | cut -d ' ' -f 1)
447- SHA256_ARM64=$(shasum -a 256 ./artifacts/ten-second-tom-osx-arm64/tom | cut -d ' ' -f 1)
448- echo "sha256-x64=$SHA256_X64" >> $GITHUB_OUTPUT
449- echo "sha256-arm64=$SHA256_ARM64" >> $GITHUB_OUTPUT
450- echo " x64 SHA256: $SHA256_X64"
451- echo " ARM64 SHA256: $SHA256_ARM64"
442+ echo "bottle-name-arm64=$BOTTLE_NAME_ARM64" >> $GITHUB_OUTPUT
443+ echo "bottle-name-x64=$BOTTLE_NAME_X64" >> $GITHUB_OUTPUT
444+ echo "bottle-tag-arm64=$BOTTLE_TAG_ARM64" >> $GITHUB_OUTPUT
445+ echo "bottle-tag-x64=$BOTTLE_TAG_X64" >> $GITHUB_OUTPUT
446+ echo "bottle-sha-arm64=$BOTTLE_SHA_ARM64" >> $GITHUB_OUTPUT
447+ echo "bottle-sha-x64=$BOTTLE_SHA_X64" >> $GITHUB_OUTPUT
452448
453- - name : Upload bottle to GitHub Packages
449+ - name : Upload bottles to GitHub release
454450 run : |
455451 VERSION="${{ needs.validate-version.outputs.version }}"
456- REPO_OWNER="${{ github.repository_owner }}"
457- BOTTLE_NAME="${{ steps.bottles.outputs.bottle-name }}"
458-
459- echo "📤 Uploading bottle to GitHub Packages (ghcr.io)"
460-
461- # Login to GitHub Container Registry
462- echo "${{ github.token }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
463-
464- # Use GitHub CLI to upload as package
465- # Note: For Homebrew bottles, we use GitHub Packages generic packages
466- # The bottle will be available at: ghcr.io/v2/$REPO_OWNER/tom/bottles/$BOTTLE_NAME
467-
468- # Create package metadata
469- PACKAGE_NAME="tom"
470- PACKAGE_URL="ghcr.io/${REPO_OWNER}/${PACKAGE_NAME}"
452+ BOTTLE_NAME_ARM64="${{ steps.bottles.outputs.bottle-name-arm64 }}"
453+ BOTTLE_NAME_X64="${{ steps.bottles.outputs.bottle-name-x64 }}"
471454
472- # Upload using oras (OCI Registry As Storage) or curl to GitHub Packages API
473- # For simplicity, we'll attach to the release as well and document the ghcr.io URL
455+ echo "📤 Uploading bottles to GitHub release"
474456
475- # Upload to GitHub release as backup
476- gh release upload "v${VERSION}" "$BOTTLE_NAME " --clobber
457+ # Upload both bottles to GitHub release
458+ gh release upload "v${VERSION}" "$BOTTLE_NAME_ARM64" "$BOTTLE_NAME_X64 " --clobber
477459
478- echo "✅ Bottle uploaded to release assets"
479- echo "📦 Bottle available at: https://github.com/${REPO_OWNER}/${{ github.event.repository.name }}/releases/download/v${VERSION}/${BOTTLE_NAME}"
460+ echo "✅ Bottles uploaded to release assets"
461+ echo "📦 ARM64: https://github.com/${{ github.repository }}/releases/download/v${VERSION}/${BOTTLE_NAME_ARM64}"
462+ echo "📦 x64: https://github.com/${{ github.repository }}/releases/download/v${VERSION}/${BOTTLE_NAME_X64}"
480463
481464 - name : Generate Homebrew formula with bottle blocks
482465 id : formula
483466 run : |
484467 VERSION="${{ needs.validate-version.outputs.version }}"
485468 REPO_OWNER="${{ github.repository_owner }}"
486469 REPO_NAME="${{ github.event.repository.name }}"
487- BOTTLE_TAG ="${{ steps.bottles.outputs.bottle-tag }}"
488- BOTTLE_SHA ="${{ steps.bottles.outputs.bottle-sha }}"
489- SHA256_X64 ="${{ steps.bottles.outputs.sha256-x64 }}"
490- SHA256_ARM64 ="${{ steps.bottles.outputs.sha256-arm64 }}"
470+ BOTTLE_TAG_ARM64 ="${{ steps.bottles.outputs.bottle-tag-arm64 }}"
471+ BOTTLE_TAG_X64 ="${{ steps.bottles.outputs.bottle-tag-x64 }}"
472+ BOTTLE_SHA_ARM64 ="${{ steps.bottles.outputs.bottle-sha-arm64 }}"
473+ BOTTLE_SHA_X64 ="${{ steps.bottles.outputs.bottle-sha-x64 }}"
491474
492475 echo "📝 Generating Homebrew formula for version $VERSION with bottle support"
493476
@@ -503,8 +486,8 @@ jobs:
503486 # Bottles (pre-built binaries) for fast installation
504487 bottle do
505488 root_url "https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/v${VERSION}"
506- sha256 cellar: :any_skip_relocation, arm64_monterey : "${SHA256_ARM64 }"
507- sha256 cellar: :any_skip_relocation, monterey : "${SHA256_X64 }"
489+ sha256 cellar: :any_skip_relocation, ${BOTTLE_TAG_ARM64} : "${BOTTLE_SHA_ARM64 }"
490+ sha256 cellar: :any_skip_relocation, ${BOTTLE_TAG_X64} : "${BOTTLE_SHA_X64 }"
508491 end
509492
510493 def install
0 commit comments