Skip to content

Commit 1fcb9f9

Browse files
committed
chore: improve release pipeline and add curl installer
1 parent 88a8c2f commit 1fcb9f9

3 files changed

Lines changed: 79 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,30 @@ jobs:
2323
EXT=""
2424
if [ "${{ matrix.goos }}" = "windows" ]; then EXT=".exe"; fi
2525
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/github-fork-manager-${{ matrix.goos }}-${{ matrix.goarch }}${EXT} ./cmd/github-fork-manager
26-
- uses: actions/upload-artifact@v4
26+
- name: Upload artifacts
27+
uses: actions/upload-artifact@v4
2728
with:
28-
name: binaries
29+
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
2930
path: dist/*
31+
retention-days: 7
32+
3033
release:
3134
runs-on: ubuntu-latest
3235
needs: build
3336
steps:
3437
- uses: actions/download-artifact@v4
3538
with:
36-
name: binaries
39+
pattern: binaries-*
3740
path: dist
41+
merge-multiple: true
42+
- name: Create checksums
43+
run: |
44+
(cd dist && shasum -a 256 * > checksums.txt)
3845
- name: Create GitHub Release
3946
uses: softprops/action-gh-release@v1
4047
with:
41-
files: dist/*
48+
files: |
49+
dist/github-fork-manager-*
50+
dist/checksums.txt
4251
env:
4352
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ Fast TUI for listing your GitHub forks and deleting many at once.
1919
```
2020
3) Provide a token with `GITHUB_TOKEN` (classic or PAT with `delete_repo` + `repo` scopes). Create one here: https://github.com/settings/tokens
2121

22+
### Quick install via curl
23+
```bash
24+
curl -fsSL https://raw.githubusercontent.com/seeg/github-fork-manager/main/scripts/install.sh | bash
25+
# optional: VERSION=v0.1.0 INSTALL_DIR=/usr/local/bin bash install.sh
26+
```
27+
2228
### Quick setup script (config)
2329
- Run `./scripts/setup-config.sh` to write `~/.github-fork-manager/config.json` interactively (token, API base, log path).
2430
- You can also just set `GITHUB_TOKEN` and skip the config file.

scripts/install.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
REPO="seeg/github-fork-manager"
5+
BINARY_NAME="github-fork-manager"
6+
INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
7+
VERSION="${VERSION:-${1:-}}"
8+
9+
detect_os_arch() {
10+
local os arch
11+
os=$(uname -s | tr '[:upper:]' '[:lower:]')
12+
arch=$(uname -m)
13+
case "$arch" in
14+
x86_64|amd64) arch="amd64" ;;
15+
arm64|aarch64) arch="arm64" ;;
16+
*) echo "Unsupported architecture: $arch" >&2; exit 1 ;;
17+
esac
18+
echo "${os}-${arch}"
19+
}
20+
21+
fetch_latest_tag() {
22+
curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" \
23+
| awk -F'"' '/tag_name/ {print $4; exit}'
24+
}
25+
26+
main() {
27+
local osarch version tag url ext tmp
28+
osarch=$(detect_os_arch)
29+
version="$VERSION"
30+
31+
if [[ -z "$version" ]]; then
32+
version=$(fetch_latest_tag)
33+
fi
34+
if [[ -z "$version" ]]; then
35+
echo "Failed to determine version; set VERSION=vX.Y.Z" >&2
36+
exit 1
37+
fi
38+
39+
ext=""
40+
if [[ "$osarch" == windows-* ]]; then
41+
ext=".exe"
42+
fi
43+
44+
tag="${version}"
45+
url="https://github.com/${REPO}/releases/download/${tag}/${BINARY_NAME}-${osarch}${ext}"
46+
tmp="$(mktemp)"
47+
48+
echo "Installing ${BINARY_NAME} ${version} for ${osarch}"
49+
echo "Downloading ${url}"
50+
curl -fL "$url" -o "$tmp"
51+
52+
mkdir -p "$INSTALL_DIR"
53+
install "$tmp" "$INSTALL_DIR/${BINARY_NAME}${ext}"
54+
rm -f "$tmp"
55+
56+
echo "Installed to $INSTALL_DIR/${BINARY_NAME}${ext}"
57+
echo "Ensure $INSTALL_DIR is on your PATH"
58+
}
59+
60+
main "$@"

0 commit comments

Comments
 (0)