aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-05-15 23:56:52 +0200
committerJustin M. Keyes <justinkz@gmail.com>2024-05-16 00:19:17 +0200
commit4399c4932d7b0565932a667e051f6861b8293157 (patch)
tree7b0e2be4dfc6c957a1309bace2976915bf796b6f
parent54044e6dce2f2a0f6785481ae179ffcfd5c7acf3 (diff)
downloadrneovim-4399c4932d7b0565932a667e051f6861b8293157.tar.gz
rneovim-4399c4932d7b0565932a667e051f6861b8293157.tar.bz2
rneovim-4399c4932d7b0565932a667e051f6861b8293157.zip
build(release.sh): use git cliff, drop old script
-rw-r--r--MAINTAIN.md4
-rw-r--r--scripts/cliff.toml22
-rwxr-xr-xscripts/git-log-pretty-since.sh52
-rwxr-xr-xscripts/release.sh12
4 files changed, 17 insertions, 73 deletions
diff --git a/MAINTAIN.md b/MAINTAIN.md
index dc2bdaf1f1..f7f0c5769c 100644
--- a/MAINTAIN.md
+++ b/MAINTAIN.md
@@ -50,9 +50,7 @@ has a major bug:
1. Fix the bug on `master`.
2. Cherry-pick the fix to `release-x.y`.
3. Cut a release from `release-x.y`.
- * Run `git cliff --config scripts/cliff.toml --unreleased -o CHANGELOG.md`
- * Run `./scripts/release.sh`
- * Paste `CHANGELOG.md` into the release commit message.
+ * Run `./scripts/release.sh` (requires [git cliff](https://github.com/orhun/git-cliff))
* The [CI job](https://github.com/neovim/neovim/blob/3d45706478cd030c3ee05b4f336164bb96138095/.github/workflows/release.yml#L11-L13)
will update the release assets and [force-push to the "stable" tag](https://github.com/neovim/neovim/blob/cdd87222c86c5b2274a13d36f23de0637462e317/.github/workflows/release.yml#L229).
diff --git a/scripts/cliff.toml b/scripts/cliff.toml
index ead7d2b821..51725cacfc 100644
--- a/scripts/cliff.toml
+++ b/scripts/cliff.toml
@@ -47,18 +47,18 @@ commit_preprocessors = [
]
# regex for parsing and grouping commits
commit_parsers = [
- { message = "!:", group = "<!-- 0 -->Breaking"},
- { message = "^feat", group = "<!-- 1 -->Features"},
- { message = "^fix", group = "<!-- 2 -->Bug Fixes"},
- { message = "^perf", group = "<!-- 3 -->Performance"},
- { message = "^build", group = "<!-- 4 -->Build System"},
- { message = "^vim-patch", group = "<!-- 5 -->Vim patches"},
- { message = "^refactor", group = "<!-- 6 -->Refactor" },
+ { message = "!:", group = "<!-- 0 -->BREAKING"},
+ { message = "^feat", group = "<!-- 1 -->FEATURES"},
+ { message = "^fix", group = "<!-- 2 -->FIXES"},
+ { message = "^perf", group = "<!-- 3 -->PERFORMANCE"},
+ { message = "^build", group = "<!-- 4 -->BUILD"},
+ { message = "^vim-patch", group = "<!-- 5 -->VIM PATCHES"},
+ { message = "^refactor", group = "<!-- 6 -->REFACTOR" },
{ message = "^ci", group = "<!-- 8 -->CI" },
- { message = "^test", group = "<!-- 9 -->Testing" },
- { message = "^docs", group = "<!-- 99 -->Documentation" },
- { message = "^revert", group = "<!-- 999 -->Reverted Changes" },
- { message = ".*", group = "<!-- 9999 -->Other"},
+ { message = "^test", group = "<!-- 9 -->TESTING" },
+ { message = "^docs", group = "<!-- 99 -->DOCUMENTATION" },
+ { message = "^revert", group = "<!-- 999 -->REVERTED CHANGES" },
+ { message = ".*", group = "<!-- 9999 -->OTHER"},
]
# filter out the commits that are not matched by commit parsers
filter_commits = true
diff --git a/scripts/git-log-pretty-since.sh b/scripts/git-log-pretty-since.sh
deleted file mode 100755
index 95dcee23f5..0000000000
--- a/scripts/git-log-pretty-since.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env bash
-
-# Prints a nicely-formatted commit history.
-# - Commits are grouped below their merge-commit.
-# - Issue numbers are moved next to the commit-id.
-#
-# Parameters:
-# $1 "since" commit
-# $2 "inverse match" regex pattern
-
-set -e
-set -u
-set -o pipefail
-
-__SINCE=$1
-__INVMATCH=$2
-
-is_merge_commit() {
- git rev-parse "$1" >/dev/null 2>&1 \
- || { echo "ERROR: invalid commit: $1"; exit 1; }
- git log "$1"^2 >/dev/null 2>&1 && return 0 || return 1
-}
-
-# Removes parens from issue/ticket/PR numbers.
-#
-# Example:
-# in: 3340e08becbf foo (#9423)
-# out: 3340e08becbf foo #9423
-_deparen() {
- sed 's/(\(\#[0-9]\{3,\}\))/\1/g'
-}
-
-# Cleans up issue/ticket/PR numbers in the commit descriptions.
-#
-# Example:
-# in: 3340e08becbf foo (#9423)
-# out: 3340e08becbf #9423 foo
-_format_ticketnums() {
- nvim -Es +'g/\v(#[0-9]{3,})/norm! ngEldE0ep' +'%p' | _deparen
-}
-
-for commit in $(git log --format='%H' --first-parent "$__SINCE"..HEAD); do
- if is_merge_commit "${commit}" ; then
- if [ -z "$__INVMATCH" ] || ! git log --oneline "${commit}^1..${commit}^2" \
- | >/dev/null 2>&1 grep -E "$__INVMATCH" ; then
- git log -1 --oneline "${commit}"
- git log --format=' %h %s' "${commit}^1..${commit}^2"
- fi
- else
- git log -1 --oneline "${commit}"
- fi
-done | _format_ticketnums
diff --git a/scripts/release.sh b/scripts/release.sh
index f63c199fc9..8e26ecb244 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -43,18 +43,16 @@ __API_LEVEL=$(grep 'set(NVIM_API_LEVEL ' CMakeLists.txt\
&& { echo "ERROR: version parse failed: '${__VERSION}'"; exit 1; }
__RELEASE_MSG="NVIM v${__VERSION}
-FEATURES:
-
-FIXES:
-
-CHANGES:
-
"
__BUMP_MSG="version bump"
echo "Most recent tag: ${__LAST_TAG}"
echo "Release version: ${__VERSION}"
+_git_log_pretty() {
+ git cliff --config scripts/cliff.toml --unreleased || echo 'git cliff failed'
+}
+
_do_release_commit() {
$__sed -i.bk 's/(NVIM_VERSION_PRERELEASE) "-dev"/\1 ""/' CMakeLists.txt
if grep '(NVIM_API_PRERELEASE true)' CMakeLists.txt > /dev/null; then
@@ -73,7 +71,7 @@ _do_release_commit() {
echo "Building changelog since ${__LAST_TAG}..."
git add CMakeLists.txt
- (echo "${__RELEASE_MSG}"; ./scripts/git-log-pretty-since.sh "$__LAST_TAG" 'vim-patch:[^[:space:]]') | git commit --edit -F -
+ (echo "${__RELEASE_MSG}"; _git_log_pretty) | git commit --edit -F -
fi
git tag --sign -a v"${__VERSION}" -m "NVIM v${__VERSION}"