Skip to content

Commit

Permalink
chore(release): add install script and update README
Browse files Browse the repository at this point in the history
- Add install.sh script to simplify installation
- Update README with instructions for quick install
- Add downloads section with links to latest binary releases
- Improve formatting and structure of README

BREAKING CHANGE: The manual installation instructions have changed. Users should now use the quick install script or download the latest binary release.
  • Loading branch information
sidedwards committed Oct 24, 2024
1 parent ebb1831 commit 437708d
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ jobs:
body: |
${{ steps.release_notes.outputs.result }}
## Downloads
## Quick Install
```bash
curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/main/scripts/install.sh | bash
```
## Manual Downloads
- [macOS ARM64 (M1/M2)](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/auto-commit-darwin-arm64)
- [macOS Intel](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/auto-commit-darwin-x64)
- [Windows](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/auto-commit-windows-x64.exe)
Expand All @@ -67,3 +72,4 @@ jobs:
dist/auto-commit-darwin-x64
dist/auto-commit-windows-x64.exe
dist/auto-commit-linux-x64
scripts/install.sh
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ Automatically generate git commit messages using Claude 3 Haiku. Analyzes your s

## Installation

### Option 1: Pre-built Binary
### Option 1: Quick Install (macOS/Linux)

```bash
curl -fsSL https://raw.githubusercontent.com/sidedwards/auto-commit/main/scripts/install.sh | bash
```

This will:
- Download the appropriate binary for your system
- Add it to your PATH
- Make it executable

### Option 2: Manual Installation

1. Download the latest release for your platform from [GitHub Releases](https://github.com/sidedwards/auto-commit/releases)
2. Move to a location in your PATH:
Expand All @@ -37,7 +48,7 @@ sudo chmod +x /usr/local/bin/auto-commit
move auto-commit-windows-x64.exe C:\Windows\System32\auto-commit.exe
```

### Option 2: Install from Source
### Option 3: Install from Source

````bash
# Install Deno
Expand All @@ -52,12 +63,12 @@ deno task install
### Updating

```bash
# If installed with quick install or manual binary
curl -fsSL https://raw.githubusercontent.com/sidedwards/auto-commit/main/scripts/install.sh | bash

# If installed from source
cd auto-commit
deno task update

# If using pre-built binary
# Download the latest release and follow installation steps above
```

## Usage
Expand Down
Empty file added install.sh
Empty file.
77 changes: 77 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
set -e

main() {
BIN_DIR=${BIN_DIR-"$HOME/.bin"}
mkdir -p $BIN_DIR

case $SHELL in
*/zsh)
PROFILE=$HOME/.zshrc
PREF_SHELL=zsh
;;
*/bash)
PROFILE=$HOME/.bashrc
PREF_SHELL=bash
;;
*/fish)
PROFILE=$HOME/.config/fish/config.fish
PREF_SHELL=fish
;;
*/ash)
PROFILE=$HOME/.profile
PREF_SHELL=ash
;;
*)
echo "could not detect shell, manually add ${BIN_DIR} to your PATH."
exit 1
esac

if [[ ":$PATH:" != *":${BIN_DIR}:"* ]]; then
echo >> $PROFILE && echo "export PATH=\"\$PATH:$BIN_DIR\"" >> $PROFILE
fi

PLATFORM="$(uname -s)"
case $PLATFORM in
Linux)
SUFFIX="linux-x64"
;;
Darwin)
ARCH="$(uname -m)"
if [ "${ARCH}" = "arm64" ]; then
SUFFIX="darwin-arm64"
else
SUFFIX="darwin-x64"
fi
;;
*)
err "unsupported platform: $PLATFORM"
;;
esac

BINARY_URL="https://github.com/sidedwards/auto-commit/releases/latest/download/auto-commit-${SUFFIX}"
if [ "$PLATFORM" = "MINGW"* ] || [ "$PLATFORM" = "MSYS"* ] || [ "$PLATFORM" = "CYGWIN"* ]; then
BINARY_URL="https://github.com/sidedwards/auto-commit/releases/latest/download/auto-commit-windows-x64.exe"
fi

echo "Downloading latest auto-commit binary..."
ensure curl -L "$BINARY_URL" -o "$BIN_DIR/auto-commit"
chmod +x "$BIN_DIR/auto-commit"

echo "auto-commit installed successfully!"
echo "Run 'auto-commit --help' to get started"
}

# Run a command that should never fail. If the command fails execution
# will immediately terminate with an error showing the failing
# command.
ensure() {
if ! "$@"; then err "command failed: $*"; fi
}

err() {
echo "$*" >&2
exit 1
}

main "$@" || exit 1

0 comments on commit 437708d

Please sign in to comment.