interplane.Get Omega
Read in your language

ggml

[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)

Brought by drakestapleton

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 <version>
6# <version>: current release version (v<maj>.<min>.<pat>, the leading v is optional)
7#
8# The previous version is the highest plain semver tag (v<maj>.<min>.<pat>)
9# strictly below <version>. 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 <version> 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
17set -euo pipefail
18
19if [[ $# -ne 1 ]]; then
20 echo "Usage: $(basename "$0") <version>"
21 exit 1
22fi
23VERSION="$1"
24
25# Accept the version with or without the leading v, reject anything else
26if [[ "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
27 VERSION="v${VERSION}"
28elif [[ ! "${VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
29 echo "Error: invalid version '${VERSION}' (expected v<maj>.<min>.<pat>)"
30 exit 1
31fi
32
33# Make sure all remote tags are available locally (skipped on local runs without origin)
34if ! git fetch --tags origin 2>/dev/null; then
35 echo "Warning: could not fetch tags from origin (local run?)"
36fi
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.
40if 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$##')"
43else
44 REPO_URL=""
45fi
46
47# Release commit: the commit <version> points at when the tag exists, HEAD otherwise.
48if ! RELEASE_COMMIT="$(git rev-parse -q --verify "refs/tags/${VERSION}^{commit}" 2>/dev/null)"; then
49 RELEASE_COMMIT="$(git rev-parse HEAD)"
50fi
51
52echo "Release commit: $(git rev-parse --short "${RELEASE_COMMIT}")"
53
54PREV="$( { 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
59if [[ -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
66else
67 CHANGELOG="(no previous release tag found)"
68 CHANGELOG_TITLE="Changelog"
69fi
70
71echo "Previous version: ${PREV:-none}"
72echo "${CHANGELOG}"
73
74if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
75 {
76 echo "previous_tag=${PREV}"
77 echo "changelog_title=${CHANGELOG_TITLE}"
78 echo "changelog<<CHANGELOG_EOF"
79 echo "${CHANGELOG}"
80 echo "CHANGELOG_EOF"
81 } >> "${GITHUB_OUTPUT}"
82fi