Skip to content

Commit 6db6b99

Browse files
chore: installation guideline (#12)
1 parent 983c515 commit 6db6b99

4 files changed

Lines changed: 88 additions & 8 deletions

File tree

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ brews:
7676
token: "{{ .Env.GITHUB_TOKEN }}"
7777
branch: main
7878
license: Apache 2.0
79-
directory: brew-formula
79+
directory: Formula
8080
url_template: "https://github.com/bucketeer-io/code-refs/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
8181
install: |
8282
bin.install "bucketeer-find-code-refs"

README.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This repository provides solutions for configuring [Bucketeer code references](h
1313
- [Linux](#linux)
1414
- [Windows](#windows)
1515
- [Docker](#docker)
16-
- [Configuration](#cli-configuration)
16+
- [Configuration](#configuration)
1717
- [Required arguments](docs/CONFIGURATION.md#required-arguments)
1818
- [All arguments](docs/CONFIGURATION.md#command-line)
1919
- [Using environment variables](docs/CONFIGURATION.md#environment-variables)
@@ -36,25 +36,36 @@ If you are scanning a git repository, `bucketeer-code-refs` requires git (tested
3636
#### macOS
3737

3838
```bash
39-
# TODO: Add installation instructions for macOS
39+
brew tap bucketeer-io/code-refs https://github.com/bucketeer-io/code-refs
40+
brew install bucketeer-find-code-refs
4041
```
4142

43+
You can now run `bucketeer-find-code-refs`.
44+
4245
#### Linux
4346

47+
Supports `x86_64`, `arm64`, and `i386`. The script auto-detects your architecture and installs via `dpkg`, `rpm`, or a binary depending on your system.
48+
4449
```bash
45-
# TODO: Add installation instructions for Linux
50+
curl -sfL https://raw.githubusercontent.com/bucketeer-io/code-refs/main/scripts/install.sh | bash
4651
```
4752

53+
You can now run `bucketeer-find-code-refs`.
54+
4855
#### Windows
4956

50-
```bash
51-
# TODO: Add installation instructions for Windows
52-
```
57+
A Windows executable of `bucketeer-find-code-refs` is available on the [releases page](https://github.com/bucketeer-io/code-refs/releases/latest).
5358

5459
#### Docker
5560

61+
`bucketeer-find-code-refs` is available as a Docker image on the GitHub Container Registry. The image provides an entrypoint for `bucketeer-find-code-refs`, to which command line arguments may be passed. Your repository to be scanned should be mounted as a volume.
62+
5663
```bash
57-
# TODO: Add Docker instructions
64+
docker pull ghcr.io/bucketeer-io/bucketeer-find-code-refs:latest
65+
docker run \
66+
-v /path/to/your/repo:/repo \
67+
ghcr.io/bucketeer-io/bucketeer-find-code-refs:latest \
68+
--dir="/repo"
5869
```
5970

6071
### Configuration

scripts/install.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
REPO="bucketeer-io/code-refs"
5+
BINARY="bucketeer-find-code-refs"
6+
7+
# Detect OS
8+
OS=$(uname -s)
9+
if [ "$OS" != "Linux" ]; then
10+
echo "This script supports Linux only."
11+
echo "For macOS, use Homebrew:"
12+
echo " brew tap bucketeer-io/code-refs https://github.com/bucketeer-io/code-refs"
13+
echo " brew install bucketeer-find-code-refs"
14+
exit 1
15+
fi
16+
17+
# Detect architecture
18+
ARCH=$(uname -m)
19+
case "$ARCH" in
20+
x86_64) PKG_ARCH="amd64"; TAR_ARCH="amd64" ;;
21+
aarch64|arm64) PKG_ARCH="arm64"; TAR_ARCH="arm64" ;;
22+
i386|i686) PKG_ARCH="i386"; TAR_ARCH="386" ;;
23+
*)
24+
echo "Unsupported architecture: $ARCH"
25+
exit 1
26+
;;
27+
esac
28+
29+
# Get latest version from GitHub
30+
VERSION=$(curl -sf "https://api.github.com/repos/$REPO/releases/latest" \
31+
| grep '"tag_name"' | cut -d'"' -f4)
32+
VERSION_NUM="${VERSION#v}"
33+
34+
echo "Installing $BINARY $VERSION for Linux/$ARCH..."
35+
36+
BASE_URL="https://github.com/$REPO/releases/download/$VERSION"
37+
38+
install_deb() {
39+
TMP=$(mktemp /tmp/bucketeer-code-refs.XXXXXX.deb)
40+
curl -sfL "$BASE_URL/code-refs_${VERSION_NUM}.${PKG_ARCH}.deb" -o "$TMP"
41+
dpkg -i "$TMP"
42+
rm -f "$TMP"
43+
}
44+
45+
install_rpm() {
46+
TMP=$(mktemp /tmp/bucketeer-code-refs.XXXXXX.rpm)
47+
curl -sfL "$BASE_URL/code-refs_${VERSION_NUM}.${PKG_ARCH}.rpm" -o "$TMP"
48+
rpm -i "$TMP"
49+
rm -f "$TMP"
50+
}
51+
52+
install_tar() {
53+
TMP_DIR=$(mktemp -d)
54+
curl -sfL "$BASE_URL/code-refs_${VERSION_NUM}_linux_${TAR_ARCH}.tar.gz" \
55+
| tar -xz -C "$TMP_DIR"
56+
install -m 755 "$TMP_DIR/$BINARY" /usr/local/bin/
57+
rm -rf "$TMP_DIR"
58+
}
59+
60+
if command -v dpkg &>/dev/null; then
61+
install_deb
62+
elif command -v rpm &>/dev/null; then
63+
install_rpm
64+
else
65+
install_tar
66+
fi
67+
68+
echo ""
69+
echo "$BINARY $VERSION installed successfully!"

0 commit comments

Comments
 (0)