-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |