Skip to content

Commit

Permalink
Include installation script
Browse files Browse the repository at this point in the history
  • Loading branch information
barthr committed Apr 12, 2023
1 parent 59fbf35 commit 20359bf
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/update-install-script.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Set Tag in Install Script

on:
release:
types: [ created ]

jobs:
set-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set Tag in Install Script
run: |
# Get the tag name from the release event payload
TAG_NAME=$(echo ${{ github.event.release.tag_name }})
# Replace <tag> in the install script with the tag name
sed -i "s/<tag>/$TAG_NAME/g" install.sh
# Commit the changes
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add install.sh
git commit -m "Set <tag> in install script to $TAG_NAME"
git push
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,16 @@ re-doing multiple commands for example deleting and starting a new docker contai

### Prebuilt binaries

Using the provided installation script

```bash
bash <(curl -s https://raw.githubusercontent.com/barthr/redo/master/install.sh)
```

Download one of the prebuilt binaries from: https://github.com/barthr/redo/releases and run the following command

```bash

tar -xf <downloaded_archive> redo && sudo mv redo /usr/local/bin
```

Expand Down Expand Up @@ -71,10 +78,12 @@ by setting the following environment variables:

`REDO_CONFIG_PATH`: The config path for redo (defaults to user config dir)

`REDO_HISTORY_PATH`: The location of the history file which redo uses to source commands (*defaults to HISTFILE **if it is
`REDO_HISTORY_PATH`: The location of the history file which redo uses to source commands (*defaults to HISTFILE **if it
is
exported**)

`REDO_EDITOR`: The editor you want to use when running commands like `redo edit` (defaults to EDITOR **if it is exported**)
`REDO_EDITOR`: The editor you want to use when running commands like `redo edit` (defaults to EDITOR **if it is exported
**)

## Shortcuts

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

# Set variables
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
TAG_WITHOUT_VERSION_PREFIX=$(echo "<tag>" | sed 's/^v//')

if [ "$OS" = "darwin" ]; then
if [ "$ARCH" = "arm64" ]; then
BINARY_NAME="redo_${TAG_WITHOUT_VERSION_PREFIX}_Darwin_arm64.tar.gz"
else
BINARY_NAME="redo_${TAG_WITHOUT_VERSION_PREFIX}_Darwin_x86_64.tar.gz"
fi
elif [ "$OS" = "linux" ]; then
if [ "$ARCH" = "arm64" ]; then
BINARY_NAME="redo_${TAG_WITHOUT_VERSION_PREFIX}_Linux_arm64.tar.gz"
else
BINARY_NAME="redo_${TAG_WITHOUT_VERSION_PREFIX}_Linux_x86_64.tar.gz"
fi
else
echo "Unsupported OS/ARCH: $OS/$ARCH"
exit 1
fi

RELEASE_URL="https://github.com/barthr/redo/releases/download/<tag>/${BINARY_NAME}"
INSTALL_PATH="/usr/local/bin"

# Download the binary
curl -L -o redo.tar.gz $RELEASE_URL

# Extract the binary and move it to the installation path
echo "Extracting and installing redo binary to $INSTALL_PATH..."
tar -zxvf redo.tar.gz redo
sudo mv redo "$INSTALL_PATH"

# Make the binary executable
sudo chmod +x $INSTALL_PATH/redo

#Cleanup
rm redo.tar.gz

# Print success message
echo "Successfully installed redo to $INSTALL_PATH"

0 comments on commit 20359bf

Please sign in to comment.