mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
build(release.sh): use git cliff, drop old script
This commit is contained in:
parent
54044e6dce
commit
4399c4932d
@ -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).
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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}"
|
||||
|
Loading…
Reference in New Issue
Block a user