Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 0 additions & 128 deletions .github/workflows/brew-release.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ target
# Added by cargo

/target
/xcloud
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ A powerful command-line interface for Apple's Xcode Cloud, built in Rust. Manage

## Installation

### Homebrew

```bash
brew tap maximbilan/xcloud https://github.com/maximbilan/xcloud
brew install xcloud
```

### From Source

```bash
Expand Down
63 changes: 63 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

set -e

# Configuration
GITHUB_USER="maximbilan"
HOMEBREW_TAP_REPO="xcloud"
PACKAGE_NAME="xcloud"
LATEST_TAG=$(git describe --tags --abbrev=0)
if [ -z "$LATEST_TAG" ]; then
echo "Error: No tags found. Please create a tag first."
exit 1
fi

# Strip 'v' prefix if it exists
VERSION=${LATEST_TAG#v}

# 1. Build the release binary
echo "Building release binary..."
cargo build --release

# 2. Create a tarball of the binary
echo "Creating tarball..."
mkdir -p "target/release/${PACKAGE_NAME}-${VERSION}"
cp "target/release/${PACKAGE_NAME}" "target/release/${PACKAGE_NAME}-${VERSION}/"
tar -czf "target/release/${PACKAGE_NAME}-${VERSION}.tar.gz" -C "target/release" "${PACKAGE_NAME}-${VERSION}"

# 3. Upload the tarball to the existing GitHub release
echo "Uploading asset to GitHub release ${LATEST_TAG}..."
gh release upload "${LATEST_TAG}" "target/release/${PACKAGE_NAME}-${VERSION}.tar.gz" --clobber

# 4. Generate a Homebrew formula
echo "Generating Homebrew formula..."
FORMULA_URL="https://github.com/${GITHUB_USER}/${PACKAGE_NAME}/releases/download/${LATEST_TAG}/${PACKAGE_NAME}-${VERSION}.tar.gz"
SHA256=$(shasum -a 256 "target/release/${PACKAGE_NAME}-${VERSION}.tar.gz" | awk '{print $1}')

cat > "${PACKAGE_NAME}.rb" <<EOF
class Xcloud < Formula
desc "A command line interface for xCloud"
homepage "https://github.com/${GITHUB_USER}/${PACKAGE_NAME}"
url "${FORMULA_URL}"
sha256 "${SHA256}"
version "${VERSION}"

def install
bin.install "xcloud"
end
end
EOF

# 5. Commit the formula to a Homebrew tap
echo "Committing formula to Homebrew tap..."
TMP_DIR=$(mktemp -d)
git clone "https://github.com/${GITHUB_USER}/${HOMEBREW_TAP_REPO}.git" "$TMP_DIR"
mkdir -p "${TMP_DIR}/Formula"
mv "${PACKAGE_NAME}.rb" "${TMP_DIR}/Formula/"
cd "$TMP_DIR"
git add "Formula/${PACKAGE_NAME}.rb"
git commit -m "feat: Add ${PACKAGE_NAME} v${VERSION}"
git push
rm -rf "$TMP_DIR"

echo "Done!"
Loading