File tree 3 files changed +57
-0
lines changed
3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 22
22
go-version-file : " go.mod"
23
23
- name : Lint
24
24
run : make lint
25
+ installer :
26
+ name : installer
27
+ runs-on : ubuntu-latest
28
+ steps :
29
+ - name : Install
30
+ run : curl -sSL https://raw.githubusercontent.com/bakito/toolbox/${GITHUB_SHA}/install.sh | sh
31
+ - name : Run binary
32
+ run : $HOME/bin/toolbox --version
25
33
test :
26
34
name : test
27
35
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 5
5
6
6
🧰 A little toolbox to help fetching tools
7
7
8
+ ## Installation
9
+
10
+ ### Linux
11
+
12
+ ``` bash
13
+ curl -sSL https://raw.githubusercontent.com/bakito/toolbox/refs/heads/main/install.sh | sh
14
+ ```
15
+
8
16
## Fetch tools
9
17
10
18
``` text
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ set -e
3
+
4
+ # Define variables
5
+ REPO=" bakito/toolbox"
6
+ INSTALL_DIR=" $HOME /bin"
7
+ BIN_NAME=" toolbox"
8
+
9
+ # Ensure the installation directory exists
10
+ mkdir -p " $INSTALL_DIR "
11
+
12
+ # Get the latest release tag
13
+ LATEST_TAG=$( curl -s " https://api.github.com/repos/$REPO /releases/latest" | grep ' "tag_name"' | cut -d ' "' -f 4)
14
+
15
+ # Construct download URL
16
+
17
+ ARCHIVE_NAME=" ${BIN_NAME} _${LATEST_TAG# v} _linux_amd64.tar.gz"
18
+ DOWNLOAD_URL=" https://github.com/$REPO /releases/download/$LATEST_TAG /$ARCHIVE_NAME "
19
+
20
+ # Temporary directory for extraction
21
+ TMP_DIR=$( mktemp -d)
22
+
23
+ # Download the archive
24
+ echo " Downloading $BIN_NAME version $LATEST_TAG ..."
25
+ curl -L " $DOWNLOAD_URL " -o " $TMP_DIR /$ARCHIVE_NAME "
26
+
27
+ # Extract the archive
28
+ tar -xzf " $TMP_DIR /$ARCHIVE_NAME " -C " $TMP_DIR "
29
+
30
+ # Move the binary to the install directory
31
+ mv " $TMP_DIR /$BIN_NAME " " $INSTALL_DIR /"
32
+
33
+ # Make it executable
34
+ chmod +x " $INSTALL_DIR /$BIN_NAME "
35
+
36
+ # Clean up
37
+ rm -rf " $TMP_DIR "
38
+
39
+ # Print success message
40
+ echo " $BIN_NAME installed successfully to $INSTALL_DIR "
41
+ echo " Add $INSTALL_DIR to your PATH if not already included"
You can’t perform that action at this time.
0 commit comments