-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Installation Script and Release Automation
- Loading branch information
1 parent
371430f
commit 4803504
Showing
5 changed files
with
111 additions
and
16 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 |
---|---|---|
|
@@ -28,4 +28,5 @@ go.work.sum | |
.idea/ | ||
|
||
# Generated binaries | ||
dicedb-cli | ||
dicedb-cli | ||
dist/ |
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,37 @@ | ||
version: 2 | ||
|
||
project_name: dicedb-cli | ||
before: | ||
hooks: | ||
- go mod tidy | ||
- go generate ./... | ||
|
||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm | ||
- arm64 | ||
binary: dicedb-cli | ||
|
||
archives: | ||
- format: tar.gz | ||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ tolower .Os }}_{{ tolower .Arch }}" | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" | ||
|
||
checksum: | ||
name_template: "checksums.txt" |
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,4 @@ | ||
release: | ||
git tag 0.0.1 | ||
git push origin 0.0.1 | ||
goreleaser release --clean |
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,59 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
REPO="DiceDB/dicedb-cli" | ||
LATEST_RELEASE=$(curl -s https://api.github.com/repos/$REPO/releases/latest | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/') | ||
|
||
# Detect the operating system and architecture | ||
OS=$(uname -s) | ||
ARCH=$(uname -m) | ||
|
||
# Convert OS/ARCH to the naming convention used in releases | ||
case $OS in | ||
Linux) OS="linux" ;; | ||
Darwin) OS="darwin" ;; | ||
CYGWIN*|MINGW32*|MSYS*|MINGW*) OS="windows" ;; | ||
*) echo "OS not supported"; exit 1 ;; | ||
esac | ||
|
||
case $ARCH in | ||
x86_64) ARCH="amd64" ;; | ||
arm64|aarch64) ARCH="arm64" ;; | ||
*) echo "Architecture not supported"; exit 1 ;; | ||
esac | ||
|
||
BINARY="dicedb-cli_${LATEST_RELEASE}_${OS}_${ARCH}.tar.gz" | ||
URL="https://github.com/$REPO/releases/download/$LATEST_RELEASE/$BINARY" | ||
|
||
echo "Downloading $BINARY..." | ||
curl -L $URL -o /tmp/$BINARY | ||
|
||
# Extract and move to /usr/local/bin | ||
tar -xzf /tmp/$BINARY -C /tmp | ||
chmod 777 /tmp/dicedb-cli | ||
|
||
DICEDB_DIR=/usr/local/dicedb | ||
DICEDB_BIN_DIR=$DICEDB_DIR/bin | ||
|
||
if [ ! -d "$DICEDB_DIR" ]; then | ||
sudo mkdir -p $DICEDB_DIR | ||
fi | ||
|
||
if [ ! -d "$DICEDB_BIN_DIR" ]; then | ||
sudo mkdir -p $DICEDB_BIN_DIR | ||
sudo chmod 777 $DICEDB_BIN_DIR | ||
fi | ||
|
||
mv /tmp/dicedb-cli $DICEDB_BIN_DIR | ||
sudo ln -sf $DICEDB_BIN_DIR/dicedb-cli /usr/local/bin/dicedb-cli | ||
|
||
echo "\n | ||
██████╗ ██╗ ██████╗███████╗██████╗ ██████╗ | ||
██╔══██╗██║██╔════╝██╔════╝██╔══██╗██╔══██╗ | ||
██║ ██║██║██║ █████╗ ██║ ██║██████╔╝ | ||
██║ ██║██║██║ ██╔══╝ ██║ ██║██╔══██╗ | ||
██████╔╝██║╚██████╗███████╗██████╔╝██████╔╝ | ||
╚═════╝ ╚═╝ ╚═════╝╚══════╝╚═════╝ ╚═════╝ | ||
" | ||
echo "> if you get 'command not found' error, add '/usr/local/bin' to your 'PATH' variable." | ||
echo "\nDiceDB CLI installation complete ✓" |