14 Commits

Author SHA1 Message Date
1239d67412 chore(version): bump version to 0.2.2
All checks were successful
Auto Changelog & Release / release (push) Successful in 8s
Create Major Version Tag / update-major-tag (release) Successful in 7s
2025-12-13 20:11:36 +01:00
a2a77a49b1 chore(changelog): normalize version headings by replacing hyphens with tildes 2025-12-13 20:11:36 +01:00
ff495030d4 chore(changelog): update changelog for v0.2.1
All checks were successful
Create Major Version Tag / update-major-tag (release) Successful in 8s
2025-12-13 15:43:35 +00:00
bdb621da15 chore(version): bump version to 0.2.1
All checks were successful
Auto Changelog & Release / release (push) Successful in 9s
2025-12-13 16:43:26 +01:00
2a2ad79bb4 chore(scripts): improve install script readability and error handling 2025-12-13 16:43:19 +01:00
ec51d271e3 chore(changelog): update unreleased changelog 2025-07-02 14:41:42 +00:00
656d08d74f refactor(help): improve help extraction for scripts
All checks were successful
Auto Changelog & Release / release (push) Successful in 8s
- Standardize help section delimiters across scripts
- Update `show_help` functions to extract help text dynamically
- Enhance maintainability and readability of help-related code
2025-07-02 16:41:33 +02:00
93a3eb41fa chore(changelog): update changelog for v0.2.0
All checks were successful
Create Major Version Tag / update-major-tag (release) Successful in 4s
2025-07-02 11:59:16 +00:00
72a343db93 chore(version): update version to 0.2.0
All checks were successful
Auto Changelog & Release / release (push) Successful in 7s
2025-07-02 13:59:09 +02:00
2ca581c65a chore(changelog): update unreleased changelog 2025-07-02 11:56:56 +00:00
fb60cee748 docs(readme): update script reference in usage example
All checks were successful
Auto Changelog & Release / release (push) Successful in 7s
- Replaces the reference to `run.sh` with `bootstrap.sh` in the README
- Reflects the file rename for clarity and consistency
2025-07-02 13:56:48 +02:00
169a1feb2e chore(changelog): update unreleased changelog 2025-07-02 11:56:20 +00:00
fd29805fa1 docs(run.sh): update script documentation and help output
All checks were successful
Auto Changelog & Release / release (push) Successful in 7s
- Improve script documentation for clarity and consistency
- Extend help output to include detailed descriptions of options
2025-07-02 13:56:09 +02:00
b1644de411 docs(script): improve help message layout and readability
- Revamps the script's help message for better clarity and usability
- Consolidates and restructures usage, options, and arguments sections
- Simplifies help text generation using `sed` to avoid redundancy
2025-07-02 13:55:58 +02:00
7 changed files with 151 additions and 72 deletions

View File

@@ -2,10 +2,23 @@
All notable changes to this project will be documented in this file.
## [unreleased]
## [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
- *(readme)* Update script reference in usage example - ([fb60cee](https://git.0xmax42.io/actions/deb-changelog-action/commit/fb60cee7482173db64f5946d493ac16d5ea6e57d))
- *(run.sh)* Update script documentation and help output - ([fd29805](https://git.0xmax42.io/actions/deb-changelog-action/commit/fd29805fa1c15310f234857362cdfaa0124051e5))
- *(script)* Improve help message layout and readability - ([b1644de](https://git.0xmax42.io/actions/deb-changelog-action/commit/b1644de411d789cb337ac250913a8aad2d53b40d))
- *(run.sh)* Clarify version reference in comments - ([f1b790d](https://git.0xmax42.io/actions/deb-changelog-action/commit/f1b790d4e3ae7d5b2d2300405f6bfdb6898dc8d2))
## [0.1.1](https://git.0xmax42.io/actions/deb-changelog-action/compare/v0.1.0..v0.1.1) - 2025-06-27

View File

@@ -9,7 +9,7 @@ This repository provides a one-liner to generate a Debian-style changelog using
You can run the generator directly from the URL:
```bash
curl -s https://git.0xmax42.io/actions/deb-changelog-action/raw/branch/main/run.sh | bash -s -- \
curl -s https://git.0xmax42.io/actions/deb-changelog-action/raw/branch/main/bootstrap.sh | bash -s -- \
--tag v2.9.1 \
--package_name my-package \
--author_name "John Doe" \

View File

@@ -1 +1 @@
0.1.1
0.2.2

View File

@@ -1,12 +1,11 @@
#!/usr/bin/env bash
#=== HELP START ===
# run.sh – local wrapper for the “deb-changelog-action”
#
# This script
# 1. clones https://git.0xmax42.io/actions/deb-changelog-action at the
# requested version into a temporary directory,
# 2. installs git-cliff using the action’s helper script, and
# 3. generates a Debian-style changelog **in the current working directory**
# via the action’s generator script.
# Behaviour:
# • Clones https://git.0xmax42.io/actions/deb-changelog-action at the requested version into a temporary directory.
# • Installs git-cliff via the action’s helper script.
# • Generates a Debian-style changelog **in the current working directory** via the action’s generator script.
#
# Usage:
# ./run.sh --version v0 \
@@ -17,6 +16,16 @@
# [--output_file debian/changelog] \
# [--cliff_config path/to/cliff.toml]
#
# Options:
# --version <ver> Action version to clone (required)
# --tag <tag> Git tag used as starting point (required)
# --package_name <name> Debian package name (required)
# --author_name <name> Changelog author name (required)
# --author_email <mail> Changelog author e-mail (required)
# --output_file <file> Changelog path (default: debian/changelog)
# --cliff_config <file> git-cliff config file (default: configs/cliff.debian.toml)
# -h, --help Show this help message
#
# Notes:
# • Paths given for --output_file are interpreted relative to the directory
# where you run this script.
@@ -24,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"
@@ -38,7 +48,14 @@ OUTPUT_FILE="debian/changelog"
CLIFF_CONFIG=""
# ───────────────────────────────────────────────
show_help() { sed -n '2,25p' "$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

View File

@@ -29,10 +29,10 @@ body = """
{% if version %}\
{% if previous.version %}\
## [{{ version | trim_start_matches(pat="v") }}]\
## [{{ version | trim_start_matches(pat="v") | replace(from="-", to="~") }}]\
({{ self::remote_url() }}/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
## [{{ version | trim_start_matches(pat="v") | replace(from="-", to="~") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% endif %}\
{% else %}\
## [unreleased]

View File

@@ -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

View File

@@ -1,17 +1,29 @@
#!/usr/bin/env bash
# install-git-cliff.sh – fetches the latest or specified git-cliff binary
# Usage (back-compatible):
# sudo ./install-git-cliff.sh # latest version, default arch/dir
# sudo ./install-git-cliff.sh 2.9.1 # specific version
# Extended options:
# sudo ./install-git-cliff.sh -a x86_64-linux-musl [<ver>] # custom arch
# sudo ./install-git-cliff.sh -d /opt/tools [<ver>] # custom install dir
# sudo ./install-git-cliff.sh -n [<ver>] # dry-run (no install)
# sudo ./install-git-cliff.sh -h | --help # help
#
#=== HELP START ===
# install-git-cliff.sh – Installs the git-cliff binary
# Usage:
# sudo ./install-git-cliff.sh [options] [<version>]
# Options:
# -a, --arch <triplet> Target architecture (default: ${DEFAULT_ARCH_DISPLAY})
# -d, --dir <path> Installation directory (default: ${INSTALL_DIR_DEFAULT})
# -n, --dry-run Download and verify, but do NOT install
# -h, --help Show this help message
# Arguments:
# <version> git-cliff version to install (default: latest)
# Behaviour:
# • If git-cliff is already in \$PATH and **no version** was requested, the script exits early.
# • If a specific version was requested, the installed version is compared; identical → exit, different → upgrade.
# • If git-cliff is already in PATH and no version was requested the script exits.
# • If a specific version was requested, the installed version is compared and
# only upgraded if it differs.
# Supported architecture triplets (examples):
# 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"
@@ -30,46 +42,46 @@ USER_VERSION_SPECIFIED=false
# 0 Help function
show_help() {
cat <<EOF
install-git-cliff.sh – Installs the git-cliff binary
Usage:
sudo ./install-git-cliff.sh [options] [<version>]
Options:
-a, --arch <triplet> Target architecture (default: ${DEFAULT_ARCH_DISPLAY})
-d, --dir <path> Installation directory (default: ${INSTALL_DIR_DEFAULT})
-n, --dry-run Download and verify, but do NOT install
-h, --help Show this help message
Arguments:
<version> git-cliff version to install (default: latest)
Behaviour:
• If git-cliff is already in PATH and no version was requested the script exits.
• If a specific version was requested, the installed version is compared and
only upgraded if it differs.
Supported architecture triplets (examples):
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-*
EOF
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
@@ -105,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
@@ -116,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}) …"
@@ -134,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