feat: update to use core tap for beads installation (#1261)

* feat: update to use core tap for beads installation

Signed-off-by: Rui Chen <rui@chenrui.dev>

* remove custom tap related code and refs

Signed-off-by: Rui Chen <rui@chenrui.dev>

---------

Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
Rui Chen
2026-01-24 20:11:21 -05:00
committed by GitHub
parent 44485bcf35
commit 66d1e63158
20 changed files with 59 additions and 598 deletions
+1 -60
View File
@@ -47,7 +47,7 @@ This master script automates the **entire release process**:
- All changes committed
- golangci-lint installed
- Homebrew installed (for local upgrade)
- Push access to steveyegge/beads and steveyegge/homebrew-beads
- Push access to steveyegge/beads
### Output
@@ -128,65 +128,6 @@ Previously, version bumps only updated `cmd/bd/version.go`, leaving other compon
---
## update-homebrew.sh
Automatically updates the Homebrew formula with GoReleaser release artifacts.
### Usage
```bash
# Update formula after pushing git tag
./scripts/update-homebrew.sh 0.9.3
# Use custom tap directory
TAP_DIR=~/homebrew-beads ./scripts/update-homebrew.sh 0.9.3
```
### What It Does
This script automates the Homebrew formula update process:
1. **Waits** for GitHub Actions release build (~5 minutes, checks every 30s)
2. **Downloads** checksums.txt from the GitHub release
3. **Extracts** SHA256s for all platform-specific binaries:
- macOS ARM64 (Apple Silicon)
- macOS AMD64 (Intel)
- Linux AMD64
- Linux ARM64
4. **Clones/updates** the homebrew-beads tap repository
5. **Updates** Formula/bd.rb with new version and all SHA256s
6. **Commits and pushes** the changes
### Important Notes
- **Run AFTER pushing the git tag** - the script waits for GitHub Actions to finish
- **Uses GoReleaser artifacts**, not source tarballs (fixed in v0.23.0)
- **Automatically waits** up to 7.5 minutes for release build to complete
- **Updates all platforms** in a single operation
### Examples
```bash
# Standard usage (after git tag push)
git tag v0.9.3 && git push origin v0.9.3
./scripts/update-homebrew.sh 0.9.3
# Custom tap directory
TAP_DIR=/path/to/homebrew-beads ./scripts/update-homebrew.sh 0.9.3
```
### Why This Script Exists
Previously, the Homebrew formula update was manual and error-prone:
- Used source tarball SHA256 instead of GoReleaser artifacts (wrong!)
- Required manually computing 4 separate SHA256s
- Easy to forget updating all platforms
- No automation for waiting on GitHub Actions
This script fixes all those issues and is now used by `release.sh`.
---
## sign-windows.sh
Signs Windows executables with an Authenticode certificate using osslsigncode.
+18 -34
View File
@@ -24,11 +24,10 @@ This script performs the complete release workflow:
1. Kill running daemons
2. Run tests and linting
3. Bump version in all files
4. Commit and push version bump
5. Create and push git tag
6. Update Homebrew formula
4. Rebuild local binary
5. Push version bump to GitHub
6. Create and push git tag
7. Upgrade local brew installation
8. Verify everything is working
Examples:
$0 0.9.3 # Full release
@@ -75,7 +74,7 @@ echo -e "${BLUE}╔════════════════════
echo ""
# Step 1: Kill daemons
echo -e "${YELLOW}Step 1/8: Killing running daemons...${NC}"
echo -e "${YELLOW}Step 1/7: Killing running daemons...${NC}"
if [ "$DRY_RUN" = true ]; then
echo "[DRY RUN] Would run: pkill -f 'bd.*daemon'"
else
@@ -90,7 +89,7 @@ fi
echo -e "${GREEN}✓ All daemons stopped${NC}\n"
# Step 2: Run tests
echo -e "${YELLOW}Step 2/8: Running tests and linting...${NC}"
echo -e "${YELLOW}Step 2/7: Running tests and linting...${NC}"
if [ "$DRY_RUN" = true ]; then
echo "[DRY RUN] Would run: TMPDIR=/tmp go test ./..."
echo "[DRY RUN] Would run: golangci-lint run ./..."
@@ -106,7 +105,7 @@ fi
echo -e "${GREEN}✓ Tests passed${NC}\n"
# Step 3: Bump version
echo -e "${YELLOW}Step 3/8: Bumping version to ${VERSION}...${NC}"
echo -e "${YELLOW}Step 3/7: Bumping version to ${VERSION}...${NC}"
if [ "$DRY_RUN" = true ]; then
echo "[DRY RUN] Would run: $SCRIPT_DIR/bump-version.sh $VERSION --commit"
$SCRIPT_DIR/bump-version.sh "$VERSION" 2>/dev/null || true
@@ -119,7 +118,7 @@ fi
echo -e "${GREEN}✓ Version bumped and committed${NC}\n"
# Step 4: Rebuild local binary
echo -e "${YELLOW}Step 4/8: Rebuilding local binary...${NC}"
echo -e "${YELLOW}Step 4/7: Rebuilding local binary...${NC}"
if [ "$DRY_RUN" = true ]; then
echo "[DRY RUN] Would run: go build -o bd ./cmd/bd"
else
@@ -133,7 +132,7 @@ fi
echo -e "${GREEN}✓ Binary rebuilt${NC}\n"
# Step 5: Push version bump
echo -e "${YELLOW}Step 5/8: Pushing version bump to GitHub...${NC}"
echo -e "${YELLOW}Step 5/7: Pushing version bump to GitHub...${NC}"
if [ "$DRY_RUN" = true ]; then
echo "[DRY RUN] Would run: git push origin main"
else
@@ -145,7 +144,7 @@ fi
echo -e "${GREEN}✓ Version bump pushed${NC}\n"
# Step 6: Create and push tag
echo -e "${YELLOW}Step 6/8: Creating and pushing git tag v${VERSION}...${NC}"
echo -e "${YELLOW}Step 6/7: Creating and pushing git tag v${VERSION}...${NC}"
if [ "$DRY_RUN" = true ]; then
echo "[DRY RUN] Would run: git tag v${VERSION}"
echo "[DRY RUN] Would run: git push origin v${VERSION}"
@@ -155,7 +154,7 @@ else
else
git tag "v${VERSION}"
fi
if ! git push origin "v${VERSION}"; then
echo -e "${RED}✗ Tag push failed${NC}"
exit 1
@@ -163,35 +162,20 @@ else
fi
echo -e "${GREEN}✓ Tag v${VERSION} pushed${NC}\n"
# Note: update-homebrew.sh now handles waiting for GitHub Actions (~5 minutes)
# No need to wait here anymore
# Step 7: Update Homebrew formula
echo -e "${YELLOW}Step 7/8: Updating Homebrew formula...${NC}"
if [ "$DRY_RUN" = true ]; then
echo "[DRY RUN] Would run: $SCRIPT_DIR/update-homebrew.sh ${VERSION}"
else
if ! $SCRIPT_DIR/update-homebrew.sh "$VERSION"; then
echo -e "${RED}✗ Homebrew update failed${NC}"
exit 1
fi
fi
echo -e "${GREEN}✓ Homebrew formula updated${NC}\n"
# Step 8: Upgrade local installation
echo -e "${YELLOW}Step 8/8: Upgrading local Homebrew installation...${NC}"
# Step 7: Upgrade local installation
echo -e "${YELLOW}Step 7/7: Upgrading local Homebrew installation...${NC}"
if [ "$DRY_RUN" = true ]; then
echo "[DRY RUN] Would run: brew update"
echo "[DRY RUN] Would run: brew upgrade bd"
echo "[DRY RUN] Would run: brew upgrade beads"
else
brew update
# Check if bd is installed via brew
if brew list bd >/dev/null 2>&1; then
brew upgrade bd || brew reinstall bd
# Check if beads is installed via brew
if brew list beads >/dev/null 2>&1; then
brew upgrade beads || brew reinstall beads
else
echo -e "${YELLOW}⚠ bd not installed via Homebrew, skipping upgrade${NC}"
echo "To install: brew install steveyegge/beads/bd"
echo "To install: brew install beads"
fi
fi
echo -e "${GREEN}✓ Local installation upgraded${NC}\n"
-213
View File
@@ -1,213 +0,0 @@
#!/bin/bash
set -euo pipefail
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Configuration
TAP_REPO="https://github.com/steveyegge/homebrew-beads"
TAP_DIR="${TAP_DIR:-/tmp/homebrew-beads}"
FORMULA_FILE="Formula/bd.rb"
usage() {
cat << EOF
Usage: $0 <version>
Automate Homebrew formula update for beads release.
Arguments:
version Version number (e.g., 0.9.3 or v0.9.3)
Environment Variables:
TAP_DIR Directory for homebrew-beads repo (default: /tmp/homebrew-beads)
Examples:
$0 0.9.3
TAP_DIR=~/homebrew-beads $0 v0.9.3
This script:
1. Waits for GitHub Actions release build to complete (~5 minutes)
2. Fetches checksums for all platform-specific release artifacts
3. Clones/updates the homebrew-beads tap repository
4. Updates the formula with new version and all platform SHA256s
5. Commits and pushes the changes
IMPORTANT: Run this AFTER pushing the git tag to GitHub.
The script will automatically wait for GitHub Actions to finish building.
EOF
exit 1
}
# Parse arguments
if [ $# -ne 1 ]; then
usage
fi
VERSION="$1"
# Strip 'v' prefix if present
VERSION="${VERSION#v}"
echo -e "${GREEN}=== Homebrew Formula Update for beads v${VERSION} ===${NC}\n"
# Step 1: Wait for GitHub Actions and fetch release checksums
echo -e "${YELLOW}Step 1: Waiting for GitHub Actions release to complete...${NC}"
echo "This typically takes ~5 minutes. Checking every 30 seconds..."
echo ""
CHECKSUMS_URL="https://github.com/steveyegge/beads/releases/download/v${VERSION}/checksums.txt"
MAX_RETRIES=15 # 15 attempts * 30s = 7.5 minutes max wait
RETRY_DELAY=30
CHECKSUMS=""
for i in $(seq 1 $MAX_RETRIES); do
echo -n "Attempt $i/$MAX_RETRIES: Checking for release artifacts... "
if CHECKSUMS=$(curl -sL "$CHECKSUMS_URL" 2>/dev/null); then
if echo "$CHECKSUMS" | grep -q "darwin_arm64"; then
echo -e "${GREEN}✓ Found!${NC}"
break
fi
fi
if [ $i -lt $MAX_RETRIES ]; then
echo -e "${YELLOW}Not ready yet, waiting ${RETRY_DELAY}s...${NC}"
sleep $RETRY_DELAY
else
echo -e "${RED}✗ Failed to fetch checksums after waiting $(($MAX_RETRIES * $RETRY_DELAY))s${NC}"
echo ""
echo "Possible issues:"
echo " • GitHub Actions release workflow is still running"
echo " • Git tag was not pushed: git push origin v${VERSION}"
echo " • Release workflow failed (check: https://github.com/steveyegge/beads/actions)"
echo ""
exit 1
fi
done
echo ""
echo -e "${GREEN}✓ Release artifacts ready${NC}"
echo ""
echo -e "${YELLOW}Extracting platform SHA256s...${NC}"
# Extract SHA256s for each platform
SHA256_DARWIN_ARM64=$(echo "$CHECKSUMS" | grep "darwin_arm64.tar.gz" | cut -d' ' -f1)
SHA256_DARWIN_AMD64=$(echo "$CHECKSUMS" | grep "darwin_amd64.tar.gz" | cut -d' ' -f1)
SHA256_LINUX_AMD64=$(echo "$CHECKSUMS" | grep "linux_amd64.tar.gz" | cut -d' ' -f1)
SHA256_LINUX_ARM64=$(echo "$CHECKSUMS" | grep "linux_arm64.tar.gz" | cut -d' ' -f1)
# Validate we got all required checksums
if [ -z "$SHA256_DARWIN_ARM64" ] || [ -z "$SHA256_DARWIN_AMD64" ] || [ -z "$SHA256_LINUX_AMD64" ]; then
echo -e "${RED}✗ Failed to extract all required SHA256s${NC}"
echo "darwin_arm64: $SHA256_DARWIN_ARM64"
echo "darwin_amd64: $SHA256_DARWIN_AMD64"
echo "linux_amd64: $SHA256_LINUX_AMD64"
exit 1
fi
echo " darwin_arm64: $SHA256_DARWIN_ARM64"
echo " darwin_amd64: $SHA256_DARWIN_AMD64"
echo " linux_amd64: $SHA256_LINUX_AMD64"
if [ -n "$SHA256_LINUX_ARM64" ]; then
echo " linux_arm64: $SHA256_LINUX_ARM64"
fi
echo ""
# Step 2: Clone/update tap repository
echo -e "${YELLOW}Step 2: Preparing tap repository...${NC}"
if [ -d "$TAP_DIR" ]; then
echo "Updating existing repository at $TAP_DIR"
cd "$TAP_DIR"
git fetch origin
git reset --hard origin/main
else
echo "Cloning repository to $TAP_DIR"
git clone "$TAP_REPO" "$TAP_DIR"
cd "$TAP_DIR"
fi
echo -e "${GREEN}✓ Repository ready${NC}\n"
# Step 3: Update formula
echo -e "${YELLOW}Step 3: Updating formula...${NC}"
if [ ! -f "$FORMULA_FILE" ]; then
echo -e "${RED}✗ Formula file not found: $FORMULA_FILE${NC}"
exit 1
fi
# Create backup
cp "$FORMULA_FILE" "${FORMULA_FILE}.bak"
# Update version number (line 4)
sed -i.tmp "s/version \"[0-9.]*\"/version \"${VERSION}\"/" "$FORMULA_FILE"
# Update SHA256s - need to handle the multi-platform structure
# We'll use awk for more precise control since the formula has multiple sha256 lines
# Use awk to update SHA256 values while preserving all structure
# Track which platform section we're in, then replace sha256 lines accordingly
awk -v sha_darwin_arm64="$SHA256_DARWIN_ARM64" \
-v sha_darwin_amd64="$SHA256_DARWIN_AMD64" \
-v sha_linux_amd64="$SHA256_LINUX_AMD64" \
-v sha_linux_arm64="$SHA256_LINUX_ARM64" '
BEGIN { in_macos=0; in_linux=0; in_arm=0 }
/on_macos do/ { in_macos=1; in_linux=0; in_arm=0 }
/on_linux do/ { in_linux=1; in_macos=0; in_arm=0 }
/if Hardware::CPU.arm/ { in_arm=1 }
/else/ { in_arm=0 }
/^[[:space:]]*end/ {
if (in_arm) { in_arm=0 }
else { in_macos=0; in_linux=0 }
}
/sha256/ {
if (in_macos && in_arm) { sub(/"[a-f0-9]+"/, "\"" sha_darwin_arm64 "\"") }
else if (in_macos && !in_arm) { sub(/"[a-f0-9]+"/, "\"" sha_darwin_amd64 "\"") }
else if (in_linux && in_arm) { sub(/"[a-f0-9]+"/, "\"" sha_linux_arm64 "\"") }
else if (in_linux && !in_arm) { sub(/"[a-f0-9]+"/, "\"" sha_linux_amd64 "\"") }
}
{ print }
' "$FORMULA_FILE" > "${FORMULA_FILE}.new"
mv "${FORMULA_FILE}.new" "$FORMULA_FILE"
rm -f "${FORMULA_FILE}.tmp"
# Show diff
echo "Changes to $FORMULA_FILE:"
git diff "$FORMULA_FILE" || true
echo -e "${GREEN}✓ Formula updated${NC}\n"
# Step 4: Commit and push
echo -e "${YELLOW}Step 4: Committing changes...${NC}"
git add "$FORMULA_FILE"
if git diff --staged --quiet; then
echo -e "${YELLOW}⚠ No changes detected - formula might already be up to date${NC}"
rm -f "${FORMULA_FILE}.bak"
exit 0
fi
git commit -m "Update bd formula to v${VERSION}"
echo -e "${GREEN}✓ Changes committed${NC}\n"
echo -e "${YELLOW}Step 5: Pushing to GitHub...${NC}"
if git push origin main; then
echo -e "${GREEN}✓ Formula pushed successfully${NC}\n"
rm -f "${FORMULA_FILE}.bak"
else
echo -e "${RED}✗ Failed to push changes${NC}"
echo "Restoring backup..."
mv "${FORMULA_FILE}.bak" "$FORMULA_FILE"
exit 1
fi
# Success message
echo -e "${GREEN}=== Homebrew Formula Update Complete ===${NC}\n"
echo "Next steps:"
echo " 1. Verify the formula update at: https://github.com/steveyegge/homebrew-beads"
echo " 2. Test locally:"
echo " brew update"
echo " brew upgrade bd"
echo " bd version # Should show v${VERSION}"
echo ""
echo -e "${GREEN}Done!${NC}"