build: generate nightly changelog from commit history (#22377)
* build: generated nightly changelog from commit history * build: update goreleaser versionpull/22405/head
parent
7ad612b0d7
commit
824e76c18d
|
@ -122,6 +122,7 @@ workflows:
|
|||
only:
|
||||
- master
|
||||
jobs:
|
||||
- changelog
|
||||
- godeps
|
||||
- gotest:
|
||||
requires:
|
||||
|
@ -137,6 +138,7 @@ workflows:
|
|||
- godeps
|
||||
- deploy_nightly:
|
||||
requires:
|
||||
- changelog
|
||||
- gotest
|
||||
- golint
|
||||
- tlstest
|
||||
|
@ -809,3 +811,35 @@ jobs:
|
|||
docker load < docker-image.tar
|
||||
docker tag quay.io/influxdb/oss-acceptance:${CIRCLE_SHA1} quay.io/influxdb/oss-acceptance:latest
|
||||
docker push quay.io/influxdb/oss-acceptance:latest
|
||||
changelog:
|
||||
machine:
|
||||
image: ubuntu-2004:202010-01
|
||||
steps:
|
||||
- checkout
|
||||
- install_core_deps
|
||||
- run:
|
||||
name: Run script
|
||||
command: |
|
||||
set -x
|
||||
git clone --depth=1 --branch v0.2.5 https://github.com/orhun/git-cliff
|
||||
cd git-cliff
|
||||
cargo install git-cliff
|
||||
cd ..
|
||||
|
||||
TIMESTAMP="$(date -u '+%Y%m%d')"
|
||||
COMMIT_FILE_PATH="scripts/ci/changelog-commit.txt"
|
||||
LAST_COMMIT=$(cat $COMMIT_FILE_PATH)
|
||||
NEWEST_COMMIT=${CIRCLE_SHA1}
|
||||
./scripts/ci/update-changelog.sh \
|
||||
--commit-range "$LAST_COMMIT..$NEWEST_COMMIT" \
|
||||
--prepend CHANGELOG.md \
|
||||
-- \
|
||||
--tag $TIMESTAMP
|
||||
echo ${CIRCLE_SHA1} > $COMMIT_FILE_PATH
|
||||
git add CHANGELOG.md $COMMIT_FILE_PATH
|
||||
git config user.email "team-edge@influxdata.com"
|
||||
git config user.name "Edge Team CircleCI Automation"
|
||||
git commit -m "changelog: update $TIMESTAMP [skip ci]"
|
||||
git push origin $CIRCLE_BRANCH
|
||||
- store_artifacts:
|
||||
path: CHANGELOG.md
|
||||
|
|
|
@ -89,6 +89,17 @@ blobs:
|
|||
bucket: "dl.influxdata.com"
|
||||
region: "us-east-1"
|
||||
folder: "platform/nightlies/"
|
||||
extra_files:
|
||||
- glob: ./CHANGELOG.md
|
||||
# Duplicating the contents to another folder in the bucket ensures
|
||||
# scheme parity with release branches; eventually the artifacts should
|
||||
# __only__ appear in the branch-specific folder
|
||||
- provider: "s3"
|
||||
bucket: "dl.influxdata.com"
|
||||
region: "us-east-1"
|
||||
folder: "platform/nightlies/master/"
|
||||
extra_files:
|
||||
- glob: ./CHANGELOG.md
|
||||
|
||||
checksum:
|
||||
name_template: "influxdb2-nightly.sha256"
|
||||
|
|
1478
CHANGELOG.md
1478
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,35 @@
|
|||
[changelog]
|
||||
body = """
|
||||
{%- if version %}
|
||||
## {{ version }} [{{ timestamp | date(format="%Y-%m-%d") }}]
|
||||
{%- else %}
|
||||
## [unreleased]
|
||||
{%- endif %}
|
||||
----------------------
|
||||
{% set grouped_commits = commits | group_by(attribute="group") -%}
|
||||
{%- set_global groups_arr = [] -%}
|
||||
{%- for group, _commits in grouped_commits -%}
|
||||
{%- set_global groups_arr = groups_arr | concat(with=group) -%}
|
||||
{%- endfor -%}
|
||||
{% for group in groups_arr | sort | reverse %}
|
||||
{% set g_commits = grouped_commits[group] -%}
|
||||
### {{ group | upper_first }}
|
||||
{% for commit in g_commits -%}
|
||||
{%- set message = commit.message | split(pat="\n") | first | split(pat=": ") | slice(start=1) | join(sep=" ") | trim | capitalize -%}
|
||||
{% set pr_num = message | split(pat=" ") | last | trim_start_matches(pat="(") | trim_end_matches(pat=")") | trim_start_matches(pat="#") %}
|
||||
{%- set message = message | split(pat=" ") | slice(end=-1) | join(sep=" ") | trim %}
|
||||
1. [{{ pr_num }}](https://github.com/influxdata/influxdb/pull/{{ pr_num }}): {{ message }}
|
||||
{%- endfor %}
|
||||
{% endfor %}
|
||||
|
||||
"""
|
||||
trim = true
|
||||
|
||||
[git]
|
||||
conventional_commits = false
|
||||
commit_parsers = [
|
||||
{ message = "^feat*", group = "Features"},
|
||||
{ message = "^fix*", group = "Bug Fixes"},
|
||||
]
|
||||
filter_commits = true
|
||||
tag_pattern = "v[12].[0-9].[0-9]*"
|
|
@ -0,0 +1 @@
|
|||
891e7d47827e99947e46c82f509e479aa13acf24
|
|
@ -0,0 +1,78 @@
|
|||
#!/bin/bash -ex
|
||||
|
||||
|
||||
dependencies="cargo git git-cliff"
|
||||
|
||||
for dependency in $dependencies
|
||||
do
|
||||
if ! command -v $dependency &>/dev/null
|
||||
then
|
||||
echo "error: $dependency was not found in PATH" >&2
|
||||
exit 255
|
||||
fi
|
||||
done
|
||||
|
||||
# The default "starting" commit is a somewhat arbitrary starting point for
|
||||
# cataloging recent commits in a way that breaks from the old convention
|
||||
DEFAULT_START_COMMIT="891e7d47827e99947e46c82f509e479aa13acf24"
|
||||
DEFAULT_NEWEST_COMMIT="$(git rev-parse HEAD)"
|
||||
DEFAULT_COMMIT_RANGE="${DEFAULT_START_COMMIT}..${DEFAULT_NEWEST_COMMIT}"
|
||||
|
||||
COMMIT_RANGE="${DEFAULT_COMMIT_RANGE}"
|
||||
|
||||
DEFAULT_GIT_CLIFF_OPTIONS=""
|
||||
PREPEND_TARGET=""
|
||||
|
||||
function print-usage {
|
||||
cat << EOF >&2
|
||||
usage: $0 [<options>] -- [<git cliff flags>] [<git cliff options>]
|
||||
|
||||
--commit-range <git commit range> The specific range of commits from which to generate the changelog.
|
||||
A hardcoded default sets a range that is contemporaneous with the
|
||||
addition of this script to influxdb CI.
|
||||
Value: $COMMIT_RANGE
|
||||
|
||||
--prepend <file path> Target a file to which to prepend the git-cliff output. This is not
|
||||
the same as the git-cliff prepend option, which can only be used with
|
||||
the -l or -u flags in that tool.
|
||||
Value: $PREPEND_TARGET
|
||||
|
||||
|
||||
Options specified after '--' separator are used by git-cliff directly
|
||||
EOF
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--commit-range)
|
||||
COMMIT_RANGE="$2"
|
||||
shift
|
||||
;;
|
||||
--prepend)
|
||||
PREPEND_TARGET="$2"
|
||||
shift
|
||||
;;
|
||||
--help)
|
||||
print-usage
|
||||
exit 255
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "error: unknown option '$1'" >&2
|
||||
exit 255
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
output="$(git cliff ${@} ${DEFAULT_GIT_CLIFF_OPTIONS} ${COMMIT_RANGE})"
|
||||
|
||||
if [ -n "$PREPEND_TARGET" ] && [ -n "$output" ]; then
|
||||
newline=$'\n\n'
|
||||
echo "${output}${newline}$(cat $PREPEND_TARGET)" > $PREPEND_TARGET
|
||||
else
|
||||
echo "$output"
|
||||
fi
|
Loading…
Reference in New Issue