Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
goarch: [amd64, arm64]

steps:
- uses: actions/checkout@v4
- uses: aadam-ali/go-release-action@62026c9f20e38c208e44b24d9d511d424149aea9
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: wangyoucao577/go-release-action@279495102627de7960cbc33434ab01a12bae144b # v1.55
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v5
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: '1.23.12'

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ go.work.sum

# env file
.env

# build directory
bin/
7 changes: 1 addition & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/TekWizely/pre-commit-golang
rev: v0.8.3
hooks:
- id: go-imports
- id: go-test-repo-mod
1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

12 changes: 0 additions & 12 deletions install.sh

This file was deleted.

26 changes: 26 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[tools]
go = "1.23.12"
pre-commit = "latest"

[tasks.pre-commit-install]
description = "Install pre-commit hooks using pre-commit and mise"
run = [
"mise generate git-pre-commit -w",
"pre-commit install"
]

[tasks.pre-commit]
description = "Run tasks for pre-commit hook"
depends = ["test"]

[tasks.deps]
description = "Update and Install Dependencies"
run = ["go get -u ./...", "go mod tidy"]

[tasks.test]
description = "Run Tests"
run = "go test -v ./..."

[tasks.build]
description = "Build"
run = ["go build -o ./bin/sb -ldflags \"-X github.com/aadam-ali/second-brain-cli/config.version=$(git rev-parse --short HEAD)\" main.go"]
63 changes: 63 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash

set -euo pipefail

SB_INSTALL_DIR=${SB_INSTALL_DIR:-${HOME}/.local/bin}

get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | jq --raw-output .tag_name
}

get_architecture() {
case "$(uname -m)" in
aarch64|arm64)
echo "arm64"
;;
x86_64|amd64)
echo "amd64"
;;
*)
echo ""
;;
esac
}

get_kernel() {
case "$(uname -s)" in
Darwin)
echo "darwin"
;;
Linux)
echo "linux"
;;
*)
echo ""
;;
esac
}

ARCH=$(get_architecture)
KERNEL=$(get_kernel)

if [ -z "$ARCH" ]; then
echo 1>&2 "ERROR: Architecture $(uname -m) is not supported."
exit 1
fi

if [ -z "$KERNEL" ]; then
echo 1>&2 "ERROR: Kernel $(uname -s) is not supported."
exit 1
fi

RELEASE_TAG=$(get_latest_release aadam-ali/second-brain-cli)
TARBALL="sb-${RELEASE_TAG}-${KERNEL}-${ARCH}.tar.gz"
TARBALL_PATH="/tmp/${TARBALL}"
TARBALL_MD5="${TARBALL}.md5"
TARBALL_MD5_PATH="/tmp/${TARBALL_MD5}"

curl -Lo "${TARBALL_PATH}" "https://github.com/aadam-ali/second-brain-cli/releases/download/${RELEASE_TAG}/${TARBALL}"
curl -Lo "${TARBALL_PATH}.md5" "https://github.com/aadam-ali/second-brain-cli/releases/download/${RELEASE_TAG}/${TARBALL_MD5}"

echo "$(cat "${TARBALL_MD5_PATH}") ${TARBALL_PATH}" | md5sum -c -

tar -C "${SB_INSTALL_DIR}" -xzf "${TARBALL_PATH}"