A container registry that uses the AT Protocol for manifest storage and S3 for blob storage.
atcr.io
docker
container
atproto
go
1#!/usr/bin/env bash
2#
3# update-homebrew-formula.sh - Helper script to update Homebrew formula with new release
4#
5# Usage: ./scripts/update-homebrew-formula.sh <version>
6#
7# Example: ./scripts/update-homebrew-formula.sh v0.0.2
8#
9# This script:
10# 1. Downloads the source tarball from GitHub
11# 2. Calculates SHA256 checksum
12# 3. Generates updated formula snippet
13#
14
15set -euo pipefail
16
17# Colors for output
18RED='\033[0;31m'
19GREEN='\033[0;32m'
20YELLOW='\033[1;33m'
21NC='\033[0m' # No Color
22
23# Check arguments
24if [ $# -ne 1 ]; then
25 echo -e "${RED}Error: Missing required argument${NC}"
26 echo "Usage: $0 <version>"
27 echo ""
28 echo "Example: $0 v0.0.2"
29 echo " $0 0.0.2 (v prefix is optional)"
30 exit 1
31fi
32
33VERSION="$1"
34
35# Add 'v' prefix if not present
36if [[ ! "$VERSION" =~ ^v ]]; then
37 VERSION="v${VERSION}"
38fi
39
40echo -e "${GREEN}Updating Homebrew formula for version ${VERSION}${NC}"
41echo ""
42
43# GitHub repository details
44GITHUB_REPO="atcr-io/atcr"
45TARBALL_URL="https://github.com/${GITHUB_REPO}/archive/refs/tags/${VERSION}.tar.gz"
46
47# Create temporary directory
48TEMP_DIR=$(mktemp -d)
49trap 'rm -rf "$TEMP_DIR"' EXIT
50
51TARBALL_FILE="${TEMP_DIR}/${VERSION}.tar.gz"
52
53echo -e "${YELLOW}Downloading source tarball...${NC}"
54echo "URL: ${TARBALL_URL}"
55
56if curl -sSfL -o "$TARBALL_FILE" "$TARBALL_URL"; then
57 # Calculate SHA256
58 if command -v sha256sum &> /dev/null; then
59 CHECKSUM=$(sha256sum "$TARBALL_FILE" | awk '{print $1}')
60 elif command -v shasum &> /dev/null; then
61 CHECKSUM=$(shasum -a 256 "$TARBALL_FILE" | awk '{print $1}')
62 else
63 echo -e "${RED}Error: sha256sum or shasum command not found${NC}"
64 exit 1
65 fi
66
67 echo -e "${GREEN}✓ Downloaded successfully${NC}"
68 echo "SHA256: $CHECKSUM"
69else
70 echo -e "${RED}✗ Failed to download source tarball${NC}"
71 echo ""
72 echo "Make sure the tag ${VERSION} exists on GitHub:"
73 echo " https://github.com/${GITHUB_REPO}/releases/tag/${VERSION}"
74 echo ""
75 echo "If you haven't pushed the tag yet, run:"
76 echo " git tag ${VERSION}"
77 echo " git push origin ${VERSION}"
78 exit 1
79fi
80
81echo ""
82echo "======================================================================"
83echo "Copy the following to Formula/docker-credential-atcr.rb:"
84echo "======================================================================"
85echo ""
86
87cat << EOF
88 url "https://github.com/${GITHUB_REPO}/archive/refs/tags/${VERSION}.tar.gz"
89 sha256 "${CHECKSUM}"
90 license "MIT"
91 head "https://github.com/${GITHUB_REPO}.git", branch: "main"
92EOF
93
94echo ""
95echo "======================================================================"
96echo ""
97echo -e "${YELLOW}Next steps:${NC}"
98echo "1. Update Formula/docker-credential-atcr.rb with the url and sha256 above"
99echo "2. Test the formula locally:"
100echo " brew install --build-from-source Formula/docker-credential-atcr.rb"
101echo " docker-credential-atcr version"
102echo "3. Commit and push to your atcr-io/homebrew-tap repository:"
103echo " cd /path/to/homebrew-tap"
104echo " cp Formula/docker-credential-atcr.rb ."
105echo " git add docker-credential-atcr.rb"
106echo " git commit -m \"Update docker-credential-atcr to ${VERSION}\""
107echo " git push"
108echo "4. Users can upgrade with:"
109echo " brew update"
110echo " brew upgrade docker-credential-atcr"