-
Notifications
You must be signed in to change notification settings - Fork 0
Improve release notes order and binary install flow #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -31,7 +31,6 @@ checksum: | |
|
|
||
| changelog: | ||
| use: git | ||
| sort: asc | ||
| filters: | ||
| exclude: | ||
| - "^docs:" | ||
|
|
||
This file contains hidden or 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 hidden or 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,90 @@ | ||
| #!/usr/bin/env sh | ||
|
|
||
| set -eu | ||
|
|
||
| REPO="keyskey/gobce" | ||
| BINARY_NAME="${BINARY_NAME:-gobce}" | ||
| INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}" | ||
|
|
||
| need_cmd() { | ||
| if ! command -v "$1" >/dev/null 2>&1; then | ||
| echo "required command not found: $1" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| detect_os() { | ||
| os="$(uname -s | tr '[:upper:]' '[:lower:]')" | ||
| case "$os" in | ||
| darwin|linux) echo "$os" ;; | ||
| *) | ||
| echo "unsupported OS: $os (supported: darwin, linux)" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| } | ||
|
|
||
| detect_arch() { | ||
| arch="$(uname -m)" | ||
| case "$arch" in | ||
| x86_64|amd64) echo "amd64" ;; | ||
| arm64|aarch64) echo "arm64" ;; | ||
| *) | ||
| echo "unsupported architecture: $arch (supported: amd64, arm64)" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| } | ||
|
|
||
| resolve_version() { | ||
| if [ -n "${VERSION:-}" ]; then | ||
| echo "$VERSION" | ||
| return | ||
| fi | ||
|
|
||
| need_cmd curl | ||
| version="$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | sed -n 's/.*"tag_name":[[:space:]]*"\([^"]*\)".*/\1/p' | sed -n '1p')" | ||
| if [ -z "$version" ]; then | ||
| echo "could not resolve latest release version; set VERSION=vX.Y.Z and retry" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "$version" | ||
| } | ||
|
|
||
| install_binary() { | ||
| need_cmd curl | ||
| need_cmd tar | ||
| need_cmd mktemp | ||
|
|
||
| os="$(detect_os)" | ||
| arch="$(detect_arch)" | ||
| version="$(resolve_version)" | ||
| version_no_v="${version#v}" | ||
| archive="${BINARY_NAME}_${version_no_v}_${os}_${arch}.tar.gz" | ||
| download_url="https://github.com/${REPO}/releases/download/${version}/${archive}" | ||
|
|
||
| tmp_dir="$(mktemp -d)" | ||
| trap 'rm -rf "$tmp_dir"' EXIT INT TERM | ||
|
|
||
| echo "downloading ${download_url}" | ||
| curl -fL -o "${tmp_dir}/${archive}" "$download_url" | ||
| tar -xzf "${tmp_dir}/${archive}" -C "$tmp_dir" | ||
|
|
||
| if [ ! -f "${tmp_dir}/${BINARY_NAME}" ]; then | ||
| echo "binary not found in archive: ${BINARY_NAME}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| mkdir -p "$INSTALL_DIR" | ||
| if command -v install >/dev/null 2>&1; then | ||
| install -m 0755 "${tmp_dir}/${BINARY_NAME}" "${INSTALL_DIR}/${BINARY_NAME}" | ||
| else | ||
| cp "${tmp_dir}/${BINARY_NAME}" "${INSTALL_DIR}/${BINARY_NAME}" | ||
| chmod 0755 "${INSTALL_DIR}/${BINARY_NAME}" | ||
| fi | ||
|
|
||
| echo "installed ${BINARY_NAME} to ${INSTALL_DIR}/${BINARY_NAME}" | ||
| echo "run: ${BINARY_NAME} --help" | ||
| } | ||
|
|
||
| install_binary |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Environment variables not propagated to piped
shprocessHigh Severity
The
VERSIONandINSTALL_DIRvariables in the install commands are not passed to theshprocess. Shell prefix assignments (VAR=value cmd) only apply to the immediate command, not commands in a pipe. This causes the install script to silently ignore the user's specified version or install directory, falling back to defaults.Reviewed by Cursor Bugbot for commit 5dd8f39. Configure here.