Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/ggml/blob/master/scripts/make-release-desc.sh # ggml [Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `ggml / scripts / make-release-desc.sh` 82 lines ยท 2876 bytes Raw Blame History 1 #!/bin/bash 2 # Generate the description of a release: the previous release version and 3 # the change log. 4 # 5 # Usage: make-release-desc.sh 6 # : current release version (v.., the leading v is optional) 7 # 8 # The previous version is the highest plain semver tag (v..) 9 # strictly below . The change log lists all commits between the 10 # previous version tag and the release commit, one line per commit. 11 # 12 # The release commit is the commit points at when the tag exists, 13 # HEAD otherwise. 14 # 15 # Env (when running in GitHub Actions): 16 # GITHUB_OUTPUT: previous_tag, changelog_title and changelog are written here 17 set -euo pipefail 18 19 if [[ $# -ne 1 ]]; then 20 echo "Usage: $(basename "$0") " 21 exit 1 22 fi 23 VERSION="$1" 24 25 # Accept the version with or without the leading v, reject anything else 26 if [[ "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then 27 VERSION="v${VERSION}" 28 elif [[ ! "${VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then 29 echo "Error: invalid version '${VERSION}' (expected v..)" 30 exit 1 31 fi 32 33 # Make sure all remote tags are available locally (skipped on local runs without origin) 34 if ! git fetch --tags origin 2>/dev/null; then 35 echo "Warning: could not fetch tags from origin (local run?)" 36 fi 37 38 # Canonical https URL of this repository (from the origin remote), used to link the previous release. 39 # Left empty on local runs without an origin remote. 40 if ORIGIN_URL="$(git remote get-url origin 2>/dev/null)"; then 41 REPO_URL="https://$(printf '%s' "${ORIGIN_URL}" \ 42 | sed -E -e 's#^git@([^:]+):#https://\1/#' -e 's#^https?://##' -e 's#\.git$##')" 43 else 44 REPO_URL="" 45 fi 46 47 # Release commit: the commit points at when the tag exists, HEAD otherwise. 48 if ! RELEASE_COMMIT="$(git rev-parse -q --verify "refs/tags/${VERSION}^{commit}" 2>/dev/null)"; then 49 RELEASE_COMMIT="$(git rev-parse HEAD)" 50 fi 51 52 echo "Release commit: $(git rev-parse --short "${RELEASE_COMMIT}")" 53 54 PREV="$( { git tag --list; echo "${VERSION}"; } \ 55 | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \ 56 | sort -V \ 57 | awk -v cur="${VERSION}" '$0 == cur { exit } { prev = $0 } END { print prev }')" 58 59 if [[ -n "${PREV}" ]]; then 60 CHANGELOG="$(git log --oneline "${PREV}..${RELEASE_COMMIT}")" 61 if [[ -n "${REPO_URL}" ]]; then 62 CHANGELOG_TITLE="Changelog since [${PREV}](${REPO_URL}/releases/tag/${PREV})" 63 else 64 CHANGELOG_TITLE="Changelog since ${PREV}" 65 fi 66 else 67 CHANGELOG="(no previous release tag found)" 68 CHANGELOG_TITLE="Changelog" 69 fi 70 71 echo "Previous version: ${PREV:-none}" 72 echo "${CHANGELOG}" 73 74 if [[ -n "${GITHUB_OUTPUT:-}" ]]; then 75 { 76 echo "previous_tag=${PREV}" 77 echo "changelog_title=${CHANGELOG_TITLE}" 78 echo "changelog<> "${GITHUB_OUTPUT}" 82 fi