Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ff495030d4 | |||
|
bdb621da15
|
|||
|
2a2ad79bb4
|
|||
| ec51d271e3 | |||
|
656d08d74f
|
10
CHANGELOG.md
10
CHANGELOG.md
@@ -2,6 +2,16 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [0.2.1](https://git.0xmax42.io/actions/deb-changelog-action/compare/v0.2.0..v0.2.1) - 2025-12-13
|
||||
|
||||
### 🚜 Refactor
|
||||
|
||||
- *(help)* Improve help extraction for scripts - ([656d08d](https://git.0xmax42.io/actions/deb-changelog-action/commit/656d08d74f299d3c90aebfa67eac74f37662568f))
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- *(scripts)* Improve install script readability and error handling - ([2a2ad79](https://git.0xmax42.io/actions/deb-changelog-action/commit/2a2ad79bb4990c1f14324180275814a274376970))
|
||||
|
||||
## [0.2.0](https://git.0xmax42.io/actions/deb-changelog-action/compare/v0.1.1..v0.2.0) - 2025-07-02
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
11
bootstrap.sh
11
bootstrap.sh
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#=== HELP START ===
|
||||
# run.sh – local wrapper for the “deb-changelog-action”
|
||||
#
|
||||
# Behaviour:
|
||||
@@ -32,6 +33,7 @@
|
||||
# (configs/cliff.debian.toml) is used.
|
||||
# • PACKAGE_NAME, AUTHOR_NAME, AUTHOR_EMAIL are exported so the TOML template
|
||||
# can reference them (e.g. {{ get_env(name="PACKAGE_NAME") }}).
|
||||
#=== HELP END ===
|
||||
set -euo pipefail
|
||||
|
||||
REPO_URL="https://git.0xmax42.io/actions/deb-changelog-action"
|
||||
@@ -46,7 +48,14 @@ OUTPUT_FILE="debian/changelog"
|
||||
CLIFF_CONFIG=""
|
||||
# ───────────────────────────────────────────────
|
||||
|
||||
show_help() { sed -n '2,34p' "$0"; }
|
||||
show_help() {
|
||||
sed -n '/^#=== HELP START ===/,/^#=== HELP END ===/ {
|
||||
/^#=== HELP START ===/d
|
||||
/^#=== HELP END ===/d
|
||||
s/^#//
|
||||
p
|
||||
}' "$0"
|
||||
}
|
||||
|
||||
# 1 ─ Parse CLI options ─────────────────────────
|
||||
while [[ $# -gt 0 ]]; do
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#=== HELP START ===
|
||||
# generate-changelog.sh – generates a Debian-style changelog via git-cliff
|
||||
#
|
||||
# Usage:
|
||||
@@ -16,6 +17,7 @@
|
||||
# • Checks that the config file exists and is readable.
|
||||
# • Ensures the parent directory of the output file exists (unless --debug).
|
||||
# • Generates the changelog; removes a leading empty line.
|
||||
#=== HELP END ===
|
||||
set -euo pipefail
|
||||
|
||||
# ───────────────────────────────────────────────
|
||||
@@ -25,7 +27,14 @@ OUT_FILE=""
|
||||
DEBUG=false
|
||||
# ───────────────────────────────────────────────
|
||||
|
||||
show_help() { sed -n '2,18p' "$0"; }
|
||||
show_help() {
|
||||
sed -n '/^#=== HELP START ===/,/^#=== HELP END ===/ {
|
||||
/^#=== HELP START ===/d
|
||||
/^#=== HELP END ===/d
|
||||
s/^#//
|
||||
p
|
||||
}' "$0"
|
||||
}
|
||||
|
||||
# 1 Parse CLI options
|
||||
while [[ $# -gt 0 ]]; do
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#=== HELP START ===
|
||||
# install-git-cliff.sh – Installs the git-cliff binary
|
||||
|
||||
# Usage:
|
||||
@@ -22,6 +23,7 @@
|
||||
# aarch64-linux-gnu / musl / apple-darwin / pc-windows-msvc
|
||||
# i686-linux-gnu / musl / pc-windows-msvc
|
||||
# x86_64-linux-gnu / musl / apple-darwin / pc-windows-*
|
||||
#=== HELP END ===
|
||||
set -euo pipefail
|
||||
|
||||
REPO="orhun/git-cliff"
|
||||
@@ -39,21 +41,47 @@ USER_VERSION_SPECIFIED=false
|
||||
# ───────────────────────────────────────────────
|
||||
|
||||
# 0 Help function
|
||||
show_help() { sed -n '2,24p' "$0"; }
|
||||
show_help() {
|
||||
sed -n '/^#=== HELP START ===/,/^#=== HELP END ===/ {
|
||||
/^#=== HELP START ===/d
|
||||
/^#=== HELP END ===/d
|
||||
s/^#//
|
||||
p
|
||||
}' "$0"
|
||||
}
|
||||
|
||||
# 1 Parse options (keeps old single-arg form)
|
||||
POSITIONAL=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-h|--help) show_help; exit 0 ;;
|
||||
-n|--dry-run) DRY_RUN=true; shift ;;
|
||||
-h | --help)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
-n | --dry-run)
|
||||
DRY_RUN=true
|
||||
shift
|
||||
;;
|
||||
-a | --arch)
|
||||
[[ $# -lt 2 ]] && { echo "❌ Option $1 requires an argument"; exit 1; }
|
||||
ARCH_OS_INPUT="$2"; shift 2 ;;
|
||||
[[ $# -lt 2 ]] && {
|
||||
echo "❌ Option $1 requires an argument"
|
||||
exit 1
|
||||
}
|
||||
ARCH_OS_INPUT="$2"
|
||||
shift 2
|
||||
;;
|
||||
-d | --dir)
|
||||
[[ $# -lt 2 ]] && { echo "❌ Option $1 requires an argument"; exit 1; }
|
||||
INSTALL_DIR="$2"; shift 2 ;;
|
||||
*) POSITIONAL+=("$1"); shift ;;
|
||||
[[ $# -lt 2 ]] && {
|
||||
echo "❌ Option $1 requires an argument"
|
||||
exit 1
|
||||
}
|
||||
INSTALL_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
POSITIONAL+=("$1")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [[ ${#POSITIONAL[@]} -gt 0 ]]; then
|
||||
@@ -89,8 +117,16 @@ if command -v git-cliff >/dev/null; then
|
||||
fi
|
||||
|
||||
# 4 Check for required tools
|
||||
need() { command -v "$1" >/dev/null || { echo "$1 is missing"; exit 1; }; }
|
||||
need curl; need tar; need grep; need sed; need awk; need jq
|
||||
need() { command -v "$1" >/dev/null || {
|
||||
echo "$1 is missing"
|
||||
exit 1
|
||||
}; }
|
||||
need curl
|
||||
need tar
|
||||
need grep
|
||||
need sed
|
||||
need awk
|
||||
need jq
|
||||
|
||||
# 5 Determine version → Fetch release JSON
|
||||
if [[ "$VERSION" == "latest" ]]; then
|
||||
@@ -100,14 +136,23 @@ else
|
||||
fi
|
||||
|
||||
echo "🔍 Fetching release info ($API_URL)…"
|
||||
JSON=$(curl -fsSL "$API_URL") || { echo "❌ Failed to fetch release info"; exit 1; }
|
||||
JSON=$(curl -fsSL "$API_URL") || {
|
||||
echo "❌ Failed to fetch release info"
|
||||
exit 1
|
||||
}
|
||||
|
||||
VERSION=$(jq -r '.tag_name' <<< "$JSON") || { echo "❌ Could not extract version"; exit 1; }
|
||||
VERSION=$(jq -r '.tag_name' <<<"$JSON") || {
|
||||
echo "❌ Could not extract version"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ASSET_URL=$(jq -r '.assets[]?.browser_download_url' <<<"$JSON" |
|
||||
grep -E "${ARCH_OS}\.(tar\.(gz|xz)|zip)$" | head -n1)
|
||||
|
||||
[[ -z "$ASSET_URL" ]] && { echo "❌ Matching asset not found for architecture ${ARCH_OS}"; exit 1; }
|
||||
[[ -z "$ASSET_URL" ]] && {
|
||||
echo "❌ Matching asset not found for architecture ${ARCH_OS}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ASSET_FILE=$(basename "$ASSET_URL")
|
||||
echo "📦 Downloading git-cliff ${VERSION} (${ASSET_FILE}) …"
|
||||
@@ -118,19 +163,30 @@ curl -#L -o "${TMP}/${ASSET_FILE}" "$ASSET_URL"
|
||||
case "$ASSET_FILE" in
|
||||
*.tar.gz | *.tgz) tar -C "$TMP" -xzf "${TMP}/${ASSET_FILE}" ;;
|
||||
*.tar.xz) tar -C "$TMP" -xJf "${TMP}/${ASSET_FILE}" ;;
|
||||
*.zip) need unzip; unzip -q "${TMP}/${ASSET_FILE}" -d "$TMP" ;;
|
||||
*) echo "❌ Unknown archive format: $ASSET_FILE"; exit 1 ;;
|
||||
*.zip)
|
||||
need unzip
|
||||
unzip -q "${TMP}/${ASSET_FILE}" -d "$TMP"
|
||||
;;
|
||||
*)
|
||||
echo "❌ Unknown archive format: $ASSET_FILE"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# 7 Locate & (maybe) install binary
|
||||
BIN_PATH=$(find "$TMP" -type f -name git-cliff -perm -u+x | head -n1)
|
||||
[[ -z "$BIN_PATH" ]] && { echo "❌ Binary not found"; exit 1; }
|
||||
[[ -z "$BIN_PATH" ]] && {
|
||||
echo "❌ Binary not found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if $DRY_RUN; then
|
||||
echo "🧪 Dry-run: verified git-cliff binary at ${BIN_PATH}"
|
||||
echo "ℹ️ Would install to: ${INSTALL_DIR}/git-cliff (sudo install -m755 …)"
|
||||
echo "✅ git-cliff $("$BIN_PATH" --version) would be installed successfully"
|
||||
else
|
||||
sudo install -m755 "$BIN_PATH" "${INSTALL_DIR}/git-cliff"
|
||||
SUDO=""
|
||||
[[ $EUID -eq 0 ]] || SUDO="sudo"
|
||||
$SUDO install -m755 "$BIN_PATH" "${INSTALL_DIR}/git-cliff"
|
||||
echo "✅ git-cliff $(git-cliff --version) installed in ${INSTALL_DIR}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user