-
Notifications
You must be signed in to change notification settings - Fork 32
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
64 additions
and
3 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 |
---|---|---|
|
@@ -3,7 +3,7 @@ name: release | |
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
- '*' | ||
|
||
permissions: | ||
contents: write | ||
|
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,63 @@ | ||
#!/bin/bash | ||
|
||
REPOOWNER="ekkinox" | ||
REPONAME="yo" | ||
RELEASETAG=$(curl -s "https://api.github.com/repos/$REPOOWNER/$REPONAME/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | ||
|
||
KERNEL=$(uname -s 2>/dev/null || /usr/bin/uname -s) | ||
case ${KERNEL} in | ||
"Linux"|"linux") | ||
KERNEL="linux" | ||
;; | ||
"Darwin"|"darwin") | ||
KERNEL="darwin" | ||
;; | ||
*) | ||
output "OS '${KERNEL}' not supported" "error" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
|
||
MACHINE=$(uname -m 2>/dev/null || /usr/bin/uname -m) | ||
case ${MACHINE} in | ||
arm|armv7*) | ||
MACHINE="arm" | ||
;; | ||
aarch64*|armv8*|arm64) | ||
MACHINE="arm64" | ||
;; | ||
i[36]86) | ||
MACHINE="386" | ||
if [ "darwin" = "${KERNEL}" ]; then | ||
output " [ ] Your architecture (${MACHINE}) is not supported anymore" "error" | ||
exit 1 | ||
fi | ||
;; | ||
x86_64) | ||
MACHINE="amd64" | ||
;; | ||
*) | ||
output " [ ] Your architecture (${MACHINE}) is not currently supported" "error" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# Define the location of the binary and the directory to install it to (can be overridden by the user) | ||
BINNAME="${BINNAME:-yo}" | ||
BINDIR="${BINDIR:-/usr/local/bin}" | ||
|
||
# Define the URLs for the release assets | ||
URL="https://github.com/$REPOOWNER/$REPONAME/releases/download/yo_${RELEASETAG}_${KERNEL}_${MACHINE}.tar.gz" | ||
|
||
echo "Downloading from $URL" | ||
echo | ||
|
||
curl -q --fail --location --progress-bar "$URL" | ||
cd "$bin_dir" | ||
tar xzf "$exe.tar.gz" | ||
chmod +x "$exe" | ||
rm "$exe.tar.gz" | ||
|
||
echo | ||
echo "Installation complete!" |