Feat: Adding homebrew cask and formula method of install (#159)
Some checks are pending
Nix / build (push) Waiting to run

This commit is contained in:
Edward? 2026-07-18 12:59:19 -04:00 committed by GitHub
parent 962979c70e
commit 19380b0585
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 191 additions and 6 deletions

View file

@ -0,0 +1,47 @@
name: Update Homebrew Cask (Stable)
on:
release:
types: [published]
jobs:
update-cask:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
- name: Download release assets and update homebrew files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ github.event.release.tag_name }}"
VERSION="${TAG#v}"
echo "Processing tag $TAG (version: $VERSION)"
mkdir -p dist
# Download the Intel dmg, Apple Silicon dmg, and Linux AppImage
gh release download "$TAG" --dir dist --pattern "*_x64.dmg" --pattern "*_aarch64.dmg" --pattern "*_amd64.AppImage" -R "${{ github.repository }}"
ls -l dist
# Calculate hashes
INTEL_HASH=$(sha256sum dist/*_x64.dmg | cut -d' ' -f1)
ARM_HASH=$(sha256sum dist/*_aarch64.dmg | cut -d' ' -f1)
LINUX_HASH=$(sha256sum dist/*_amd64.AppImage | cut -d' ' -f1)
echo "Intel SHA: $INTEL_HASH"
echo "ARM SHA: $ARM_HASH"
echo "Linux SHA: $LINUX_HASH"
python3 scripts/update-homebrew.py --type stable --version "$VERSION" --intel-hash "$INTEL_HASH" --arm-hash "$ARM_HASH" --linux-hash "$LINUX_HASH"
- name: Commit and push changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add Casks/ Formula/
git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update stable Homebrew casks/formula [skip ci]" && git push origin main)

View file

@ -0,0 +1,18 @@
cask "lce-emerald-launcher" do
version "1.5.1"
sha256 intel: "7826e105f283f22cb5784b7e0dd3c90b8fc493a636ca11333a4b867f3e1a9891",
arm: "e1c392213e0d34546f55971a1e381b942d2c896671576a18ab1db4ff1d4270b9"
url "https://github.com/LCE-Hub/LCE-Emerald-Launcher/releases/download/v#{version}/LCE.Emerald.Launcher_#{version}_#{arch}.dmg"
name "LCE Emerald Launcher"
desc "Minecraft Legacy Console Edition Launcher"
homepage "https://github.com/LCE-Hub/LCE-Emerald-Launcher"
app "LCE Emerald Launcher/LCE Emerald Launcher.app"
zap trash: [
"~/Library/Application Support/com.emerald.legacy",
"~/Library/Preferences/com.emerald.legacy.plist",
"~/Library/Saved Application State/com.emerald.legacy.savedState",
]
end

View file

@ -0,0 +1,19 @@
class LceEmeraldLauncher < Formula
desc "Minecraft Legacy Console Edition Launcher"
homepage "https://github.com/LCE-Hub/LCE-Emerald-Launcher-cask"
url "https://github.com/LCE-Hub/LCE-Emerald-Launcher/releases/download/v#{version}/LCE.Emerald.Launcher_#{version}_amd64.AppImage"
sha256 "541271f927249fdfc4ada03b72110cdacaef388ed33b7d75724545145b8c412f"
version "1.5.0"
license "GPL-3.0-only"
depends_on :linux
def install
# Rename and install the AppImage
bin.install "LCE.Emerald.Launcher_#{version}_amd64.AppImage" => "lce-emerald-launcher"
end
test do
assert_predicate bin/"lce-emerald-launcher", :exist?
end
end

View file

@ -90,6 +90,7 @@ LCE Emerald Launcher is the easiest way to play Minecraft Legacy Console Edition
|--------|-------------|
| `.dmg` (x64) | Intel Macs |
| `.dmg` (aarch64) | Apple Silicon (M-series and A-series) |
| Homebrew Cask | Intel & Apple Silicon (via tap) |
**Installation Steps:**
1. Download the appropriate DMG for your Mac
@ -98,6 +99,15 @@ LCE Emerald Launcher is the easiest way to play Minecraft Legacy Console Edition
- Right-click the app → **Open** → confirm **Open**
- Or run: `xattr -cr "/Applications/Emerald Legacy Launcher.app"`
**Homebrew:**
```bash
# Tap the repository
brew tap LCE-Hub/lce-emerald-launcher https://github.com/LCE-Hub/LCE-Emerald-Launcher
# Install stable release
brew install --cask lce-emerald-launcher
```
### GNU/Linux
Multiple distribution formats available:
@ -109,6 +119,7 @@ Multiple distribution formats available:
| `.AppImage` | Universal (no installation required) |
| `.flatpak` | Universal with sandboxing (recommended over AppImage) |
| Nix flake | NixOS and any Linux with [Nix](https://nixos.org/download/) installed |
| Homebrew | Any Linux with [Homebrew](https://brew.sh/) installed |
**AUR:**
Special thanks to [AntiApple4life](https://aur.archlinux.org/packages?O=0&SeB=m&K=AntiApple4life) for the AUR packages!
@ -152,6 +163,15 @@ sudo emerge games-util/emerald-legacy-launcher # 1.5.1
flatpak install emerald.flatpak
```
**Homebrew:**
```bash
# Tap the repository
brew tap LCE-Hub/lce-emerald-launcher https://github.com/LCE-Hub/LCE-Emerald-Launcher
# Install stable release
brew install lce-emerald-launcher
```
**Dependencies (if building from source):**
```bash
# Ubuntu/Debian

View file

@ -9,13 +9,13 @@ APP_PATH="$1"
BUNDLE_ID="com.emerald.legacy"
if [ -z "$APP_PATH" ]; then
echo "Usage: $0 <path-to-app-bundle>"
exit 1
echo "Usage: $0 <path-to-app-bundle>"
exit 1
fi
if [ ! -d "$APP_PATH" ]; then
echo "Error: App bundle not found at $APP_PATH"
exit 1
echo "Error: App bundle not found at $APP_PATH"
exit 1
fi
echo "Fixing macOS quarantine for: $APP_PATH"
@ -25,8 +25,8 @@ xattr -cr "$APP_PATH"
# Add basic code signing (ad-hoc signature)
codesign --force --deep --sign - "$APP_PATH" 2>/dev/null || {
echo "Warning: Code signing failed, but quarantine removal should work"
echo "Warning: Code signing failed, but quarantine removal should work"
}
echo "macOS quarantine fix completed"
echo "macOS quarantine fix completed"
echo "The app should now launch without 'damaged' error"

View file

@ -0,0 +1,81 @@
import argparse
import re
import os
def update_stable(version, intel_hash, arm_hash, linux_hash):
cask_path = "Casks/lce-emerald-launcher.rb"
formula_path = "Formula/lce-emerald-launcher.rb"
# Update Cask
if os.path.exists(cask_path):
with open(cask_path, 'r') as f:
content = f.read()
# Replace version
content = re.sub(r'^\s*version\s+"[^"]+"', f' version "{version}"', content, flags=re.MULTILINE)
# Replace sha256 block
content = re.sub(r'sha256\s+intel:\s+"[a-f0-9]+",\r?\n\s+arm:\s+"[a-f0-9]+"',
f'sha256 intel: "{intel_hash}",\n arm: "{arm_hash}"',
content)
with open(cask_path, 'w') as f:
f.write(content)
print(f"Updated {cask_path}")
else:
print(f"Error: {cask_path} not found")
# Update Formula
if os.path.exists(formula_path):
with open(formula_path, 'r') as f:
content = f.read()
# Replace version
content = re.sub(r'^\s*version\s+"[^"]+"', f' version "{version}"', content, flags=re.MULTILINE)
# Replace sha256
content = re.sub(r'^\s*sha256\s+"[a-f0-9]+"', f' sha256 "{linux_hash}"', content, flags=re.MULTILINE)
with open(formula_path, 'w') as f:
f.write(content)
print(f"Updated {formula_path}")
else:
print(f"Error: {formula_path} not found")
def update_experimental(version, intel_hash, arm_hash):
cask_path = "Casks/lce-emerald-launcher-experimental.rb"
if os.path.exists(cask_path):
with open(cask_path, 'r') as f:
content = f.read()
# Replace version
content = re.sub(r'^\s*version\s+"[^"]+"', f' version "{version}"', content, flags=re.MULTILINE)
# Replace sha256 block
content = re.sub(r'sha256\s+intel:\s+"[a-f0-9]+",\r?\n\s+arm:\s+"[a-f0-9]+"',
f'sha256 intel: "{intel_hash}",\n arm: "{arm_hash}"',
content)
with open(cask_path, 'w') as f:
f.write(content)
print(f"Updated {cask_path}")
else:
print(f"Error: {cask_path} not found")
def main():
parser = argparse.ArgumentParser(description="Update Homebrew Formula/Cask files")
parser.add_argument("--type", choices=["stable" ], required=True)
parser.add_argument("--version", required=True)
parser.add_argument("--intel-hash", required=True)
parser.add_argument("--arm-hash", required=True)
parser.add_argument("--linux-hash")
args = parser.parse_args()
if args.type == "stable":
if not args.linux_hash:
raise ValueError("--linux-hash is required for stable update")
update_stable(args.version, args.intel_hash, args.arm_hash, args.linux_hash)
elif args.type == "experimental":
update_experimental(args.version, args.intel_hash, args.arm_hash)
if __name__ == "__main__":
main()