From 0e129c34836756a056eecd0d5d1527679ec7f670 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 28 May 2021 15:23:08 +0200 Subject: [PATCH 1/4] feat: automate pre-generation of Changelog --- .chglog/CHANGELOG.tpl.md | 56 ++++++++++++++++++++++++++++++++++++++++ .chglog/config.yml | 30 +++++++++++++++++++++ .gitignore | 1 + Makefile | 4 +++ 4 files changed, 91 insertions(+) create mode 100755 .chglog/CHANGELOG.tpl.md create mode 100755 .chglog/config.yml diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md new file mode 100755 index 00000000000..c2b5a55cdb4 --- /dev/null +++ b/.chglog/CHANGELOG.tpl.md @@ -0,0 +1,56 @@ +{{ if .Versions -}} + +## [Unreleased] + +{{ if .Unreleased.CommitGroups -}} +{{ range .Unreleased.CommitGroups -}} +### {{ .Title }} +{{ range .Commits -}} +- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} + +{{ range .Versions }} + +## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }} +{{ range .CommitGroups -}} +### {{ .Title }} +{{ range .Commits -}} +- {{ if .Scope }}**{{ upperFirst .Scope }}:** {{ end }}{{ .Subject }} +{{ end }} +{{ end -}} + +{{- if .RevertCommits -}} +### Reverts +{{ range .RevertCommits -}} +- {{ .Revert.Header }} +{{ end }} +{{ end -}} + +{{- if .MergeCommits -}} +### Pull Requests +{{ range .MergeCommits -}} +- {{ .Header }} +{{ end }} +{{ end -}} + +{{- if .NoteGroups -}} +{{ range .NoteGroups -}} +### {{ .Title }} +{{ range .Notes }} +{{ .Body }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} + +{{- if .Versions }} +[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD +{{ range .Versions -}} +{{ if .Tag.Previous -}} +[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }} +{{ end -}} +{{ end -}} +{{ end -}} diff --git a/.chglog/config.yml b/.chglog/config.yml new file mode 100755 index 00000000000..845f65d0c08 --- /dev/null +++ b/.chglog/config.yml @@ -0,0 +1,30 @@ +style: github +template: CHANGELOG.tpl.md +info: + title: CHANGELOG + repository_url: https://github.com/awslabs/aws-lambda-powertools-python +options: + commits: + filters: + Type: + - feat + - fix + - perf + - refactor + - docs + commit_groups: + title_maps: + feat: Features + fix: Bug Fixes + perf: Performance Improvements + refactor: Code Refactoring + docs: Documentation + header: + pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" + pattern_maps: + - Type + - Scope + - Subject + notes: + keywords: + - BREAKING CHANGE diff --git a/.gitignore b/.gitignore index ace70c8192d..ce5e32bd3e1 100644 --- a/.gitignore +++ b/.gitignore @@ -295,6 +295,7 @@ test_report wheelhouse /.idea/* *.html +TMP_CHANGELOG.md # Docs files docs/.cache/ diff --git a/Makefile b/Makefile index b0a075d39a2..018f9c9420d 100644 --- a/Makefile +++ b/Makefile @@ -79,3 +79,7 @@ release: pr poetry build $(MAKE) release-test $(MAKE) release-prod + +changelog: + @echo "[+] Pre-generating CHANGELOG for tag: $$(git describe --abbrev=0 --tag)" + docker run -v ${PWD}:/workdir quay.io/git-chglog/git-chglog $$(git describe --abbrev=0 --tag).. -o TMP_CHANGELOG.md From 5ce7ba71dd92d4cfeaa921aa32210a7422ee1fdc Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 28 May 2021 15:41:31 +0200 Subject: [PATCH 2/4] chore: auto-label PRs based on path --- .github/auto-label.json | 10 -------- .github/boring-cyborg.yml | 49 ++++++++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 19 deletions(-) delete mode 100644 .github/auto-label.json diff --git a/.github/auto-label.json b/.github/auto-label.json deleted file mode 100644 index 1218790bdc4..00000000000 --- a/.github/auto-label.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "rules": { - "area/utilities": ["aws_lambda_powertools_python/utilities/", "aws_lambda_powertools_python/utilities/", "aws_lambda_powertools_python/middleware_factory/"], - "area/logger": ["aws_lambda_powertools_python/logging/"], - "area/tracer": ["aws_lambda_powertools_python/tracing/"], - "area/metrics": ["aws_lambda_powertools_python/metrics/"], - "documentation": ["docs/", "mkdocs.yml"], - "internal": ["Makefile", "CHANGELOG.md", "CONTRIBUTING.md"] - } -} diff --git a/.github/boring-cyborg.yml b/.github/boring-cyborg.yml index 89d93b17e37..f79494d01aa 100644 --- a/.github/boring-cyborg.yml +++ b/.github/boring-cyborg.yml @@ -1,21 +1,52 @@ ##### Labeler ########################################################################################################## labelPRBasedOnFilePath: area/utilities: + - aws_lambda_powertools/utilities/* - aws_lambda_powertools/utilities/**/* + - aws_lambda_powertools_python/middleware_factory/* + - aws_lambda_powertools_python/middleware_factory/**/* + area/logger: + - aws_lambda_powertools_python/logging/* + - aws_lambda_powertools_python/logging/**/* + - aws_lambda_powertools_python/package_logger.py + area/tracer: + - aws_lambda_powertools_python/tracing/* + - aws_lambda_powertools_python/tracing/**/* + area/metrics: + - aws_lambda_powertools_python/metrics/* + - aws_lambda_powertools_python/metrics/**/* + area/event_handlers: + - aws_lambda_powertools_python/event_handler/* + - aws_lambda_powertools_python/event_handler/**/* - # Add 'label2' to any file changes within 'example2' folder documentation: - docs/* - docs/**/* + - mkdocs.yml -# # Complex: Add 'area/core' label to any change within the 'core' package -# area/core: -# - src/core/* -# - src/core/**/* -# -# # Add 'test' label to any change to *.spec.js files within the source dir -# test: -# - src/**/*.spec.js + internal: + - .github/* + - .github/**/* + - .chglog/* + - .flake8 + - .gitignore + - .pre-commit-config.yaml + - Makefile + - CONTRIBUTING.md + - CODE_OF_CONDUCT.md + - LICENSE + - aws_lambda_powertools_python/shared/* + - aws_lambda_powertools_python/shared/** + + dependencies: + - pyproject.toml + - poetry.lock + + tests: + - tests/* + - tests/**/* + - benchmark/* + - benchmark/**/* ##### Greetings ######################################################################################################## firstPRWelcomeComment: > From 2cf329412a37443ab6ef7c984c5761f30b4f1e2f Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 28 May 2021 15:43:14 +0200 Subject: [PATCH 3/4] chore: include project maintenance section --- .chglog/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.chglog/config.yml b/.chglog/config.yml index 845f65d0c08..294b3289981 100755 --- a/.chglog/config.yml +++ b/.chglog/config.yml @@ -12,6 +12,7 @@ options: - perf - refactor - docs + - chore commit_groups: title_maps: feat: Features @@ -19,6 +20,7 @@ options: perf: Performance Improvements refactor: Code Refactoring docs: Documentation + chore: Project maintenance header: pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" pattern_maps: From 6b70d7ca20a9eb5981650d3d5adceb0c569a8182 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 28 May 2021 15:46:31 +0200 Subject: [PATCH 4/4] chore: update manual activities w/ new make changelog --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 246992ec244..42eeae4b0f0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,7 +4,7 @@ name: Publish to PyPi # # === Manual activities === # -# 1. Document human readable changes in CHANGELOG +# 1. Document human readable changes in CHANGELOG (pre-generate unreleased changes with `make changelog`) # 2. Bump package version using poetry version # 3. Merge version changes to develop branch # 4. Edit the current draft release notes