Skip to content

Commit c080c91

Browse files
committed
chore(ci): add changelog generation
1 parent fc07acd commit c080c91

File tree

5 files changed

+315
-0
lines changed

5 files changed

+315
-0
lines changed

.chglog/CHANGELOG.tpl.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{{ if .Versions -}}
2+
<a name="unreleased"></a>
3+
## Unreleased
4+
5+
{{ if .Unreleased.CommitGroups -}}
6+
{{ range .Unreleased.CommitGroups -}}
7+
### {{ .Title }}
8+
9+
{{ range .Commits -}}
10+
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
11+
{{ end }}
12+
{{ end -}}
13+
{{ end -}}
14+
{{ end -}}
15+
16+
{{ range .Versions }}
17+
<a name="{{ .Tag.Name }}"></a>
18+
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
19+
{{ range .CommitGroups -}}
20+
### {{ .Title }}
21+
22+
{{ range .Commits -}}
23+
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
24+
{{ end }}
25+
{{ end -}}
26+
27+
{{- if .RevertCommits -}}
28+
### Reverts
29+
{{ range .RevertCommits -}}
30+
* {{ .Revert.Header }}
31+
{{ end }}
32+
{{ end -}}
33+
34+
{{- if .MergeCommits -}}
35+
### Pull Requests
36+
37+
{{ range .MergeCommits -}}
38+
* {{ .Header }}
39+
{{ end }}
40+
{{ end -}}
41+
42+
{{- if .NoteGroups -}}
43+
{{ range .NoteGroups -}}
44+
### {{ .Title }}
45+
{{ range .Notes }}
46+
{{ .Body }}
47+
{{ end }}
48+
{{ end -}}
49+
{{ end -}}
50+
{{ end -}}
51+
52+
{{- if .Versions }}
53+
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
54+
{{ range .Versions -}}
55+
{{ if .Tag.Previous -}}
56+
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
57+
{{ end -}}
58+
{{ end -}}
59+
{{ end -}}

.chglog/config.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
style: github
2+
template: CHANGELOG.tpl.md
3+
info:
4+
title: CHANGELOG
5+
repository_url: https://github.com/awslabs/aws-lambda-powertools-python
6+
options:
7+
commits:
8+
filters:
9+
Type:
10+
- feat
11+
- fix
12+
- perf
13+
- refactor
14+
- docs
15+
- chore
16+
- revert
17+
commit_groups:
18+
title_maps:
19+
feat: Features
20+
fix: Bug Fixes
21+
perf: Performance Improvements
22+
refactor: Code Refactoring
23+
docs: Documentation
24+
chore: Maintenance
25+
revert: Regression
26+
header:
27+
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
28+
pattern_maps:
29+
- Type
30+
- Scope
31+
- Subject
32+
notes:
33+
keywords:
34+
- BREAKING CHANGE
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish to PyPi
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0
14+
- name: Set release notes tag
15+
run: |
16+
RELEASE_TAG_VERSION=${{ github.event.release.tag_name }}
17+
echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION:1}" >> $GITHUB_ENV
18+
- name: Generate changelog
19+
run: make changelog
20+
- name: Git setup
21+
run: |
22+
# setup the username and email. I tend to use 'GitHub Actions Bot' with no email by default
23+
git config user.name "Release bot"
24+
git config user.email "<>"
25+
26+
- name: Update Changelog in trunk
27+
run: |
28+
git add CHANGELOG
29+
git commit -m "chore(ci): update changelog with version ${RELEASE_TAG_VERSION}"
30+
git push origin master

Makefile

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
.PHONY: target dev format lint test coverage-html pr build build-docs build-docs-api build-docs-website
2+
.PHONY: docs-local docs-api-local security-baseline complexity-baseline release-prod release-test release
3+
4+
target:
5+
@$(MAKE) pr
6+
7+
dev:
8+
pip install --upgrade pip pre-commit poetry
9+
poetry install --extras "pydantic"
10+
pre-commit install
11+
12+
format:
13+
poetry run isort aws_lambda_powertools tests examples
14+
poetry run black aws_lambda_powertools tests examples
15+
16+
lint: format
17+
poetry run flake8 aws_lambda_powertools tests examples
18+
19+
lint-docs:
20+
docker run -v ${PWD}:/markdown 06kellyjac/markdownlint-cli "docs"
21+
22+
lint-docs-fix:
23+
docker run -v ${PWD}:/markdown 06kellyjac/markdownlint-cli --fix "docs"
24+
25+
test:
26+
poetry run pytest -m "not perf" --cov=aws_lambda_powertools --cov-report=xml
27+
poetry run pytest --cache-clear tests/performance
28+
29+
unit-test:
30+
poetry run pytest tests/unit
31+
32+
coverage-html:
33+
poetry run pytest -m "not perf" --cov=aws_lambda_powertools --cov-report=html
34+
35+
pre-commit:
36+
pre-commit run --show-diff-on-failure
37+
38+
pr: lint lint-docs mypy pre-commit test security-baseline complexity-baseline
39+
40+
build: pr
41+
poetry build
42+
43+
release-docs:
44+
@echo "Rebuilding docs"
45+
rm -rf site api
46+
@echo "Updating website docs"
47+
poetry run mike deploy --push --update-aliases ${VERSION} ${ALIAS}
48+
@echo "Building API docs"
49+
@$(MAKE) build-docs-api
50+
51+
build-docs-api:
52+
poetry run pdoc --html --output-dir ./api/ ./aws_lambda_powertools --force
53+
mv -f ./api/aws_lambda_powertools/* ./api/
54+
rm -rf ./api/aws_lambda_powertools
55+
56+
docs-local:
57+
poetry run mkdocs serve
58+
59+
docs-local-docker:
60+
docker build -t squidfunk/mkdocs-material ./docs/
61+
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
62+
63+
docs-api-local:
64+
poetry run pdoc --http : aws_lambda_powertools
65+
66+
security-baseline:
67+
poetry run bandit --baseline bandit.baseline -r aws_lambda_powertools
68+
69+
complexity-baseline:
70+
$(info Maintenability index)
71+
poetry run radon mi aws_lambda_powertools
72+
$(info Cyclomatic complexity index)
73+
poetry run xenon --max-absolute C --max-modules A --max-average A aws_lambda_powertools
74+
75+
#
76+
# Use `poetry version <major>/<minor></patch>` for version bump
77+
#
78+
release-prod:
79+
poetry config pypi-token.pypi ${PYPI_TOKEN}
80+
poetry publish -n
81+
82+
release-test:
83+
poetry config repositories.testpypi https://test.pypi.org/legacy
84+
poetry config pypi-token.pypi ${PYPI_TEST_TOKEN}
85+
poetry publish --repository testpypi -n
86+
87+
release: pr
88+
poetry build
89+
$(MAKE) release-test
90+
$(MAKE) release-prod
91+
92+
changelog:
93+
git fetch --tags origin
94+
@echo "[+] Pre-generating CHANGELOG for tag: $$(git describe --abbrev=0 --tag)"
95+
docker run -v "${PWD}":/workdir quay.io/git-chglog/git-chglog $$(git describe --abbrev=0 --tag).. > CHANGELOG.md
96+
97+
mypy:
98+
poetry run mypy --pretty aws_lambda_powertools

TMP_CHANGELOG.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<a name="unreleased"></a>
2+
## Unreleased
3+
4+
### Bug Fixes
5+
6+
* action syntax
7+
* **actions:** graphql type ([#10](https://github.com/awslabs/aws-lambda-powertools-python/issues/10))
8+
* **actions:** type mismatch query
9+
* **ci:** action syntax [#2](https://github.com/awslabs/aws-lambda-powertools-python/issues/2)
10+
* **workflow:** async await syntax in anonymous fn
11+
12+
### Maintenance
13+
14+
* auto-merge action-script 3
15+
* linting [#2](https://github.com/awslabs/aws-lambda-powertools-python/issues/2)
16+
* linting rome [#3](https://github.com/awslabs/aws-lambda-powertools-python/issues/3)
17+
* linting rome [#4](https://github.com/awslabs/aws-lambda-powertools-python/issues/4)
18+
* linting rome [#5](https://github.com/awslabs/aws-lambda-powertools-python/issues/5)
19+
* on pr merge test
20+
* dummy add ([#4](https://github.com/awslabs/aws-lambda-powertools-python/issues/4))
21+
* remove leftover
22+
* dummy add 2 ([#5](https://github.com/awslabs/aws-lambda-powertools-python/issues/5))
23+
* auto-merge action-script 2
24+
* dummy add 3
25+
* dummy add 3 ([#6](https://github.com/awslabs/aws-lambda-powertools-python/issues/6))
26+
* stringify nested workflow_run obj
27+
* dummy add 4 ([#7](https://github.com/awslabs/aws-lambda-powertools-python/issues/7))
28+
* dummy add 5 ([#8](https://github.com/awslabs/aws-lambda-powertools-python/issues/8))
29+
* linting
30+
* dummy add 6 ([#9](https://github.com/awslabs/aws-lambda-powertools-python/issues/9))
31+
* auto-merge action-script
32+
* move env to constants file
33+
* auto-merge debug 1
34+
* sync workflows
35+
* blah ([#11](https://github.com/awslabs/aws-lambda-powertools-python/issues/11))
36+
* dummy remove ([#12](https://github.com/awslabs/aws-lambda-powertools-python/issues/12))
37+
* last try ([#13](https://github.com/awslabs/aws-lambda-powertools-python/issues/13))
38+
* auto-merge trial 1
39+
* auto-merge trial 2
40+
* trigger ci ([#19](https://github.com/awslabs/aws-lambda-powertools-python/issues/19))
41+
* auto-merge debug 2
42+
* auto-merge auth
43+
* auto-merge debug
44+
* trigger ci ([#18](https://github.com/awslabs/aws-lambda-powertools-python/issues/18))
45+
* troubleshoot invalid json 1
46+
* move conditional to code
47+
* auto-merge debug 3
48+
* replicate workflow_run related pr
49+
* **action:** add links
50+
* **action:** debug workflow
51+
* **actions:** add gh-script
52+
* **actions:** add gh-script
53+
* **ci:** re-add raw event
54+
* **ci:** trigger PR ([#14](https://github.com/awslabs/aws-lambda-powertools-python/issues/14))
55+
* **ci:** export entire pr event
56+
* **ci:** trigger part 3 ([#16](https://github.com/awslabs/aws-lambda-powertools-python/issues/16))
57+
* **ci:** trigger pr 2 ([#15](https://github.com/awslabs/aws-lambda-powertools-python/issues/15))
58+
* **ci:** fix readfilesync
59+
* **ci:** include pr key only in event
60+
* **ci:** include encoding in filesync
61+
* **ci:** remove newline from foreign object
62+
* **ci:** enforce obj recursion
63+
* **ci:** export full PR object as JSON str
64+
* **ci:** exp graphql
65+
* **ci:** fix reserved gql var name
66+
* **ci:** debug array logic
67+
* **ci:** debug array logic 2 with old syntax
68+
* **ci:** debug array logic 3
69+
* **ci:** debug array logic 4
70+
* **ci:** debug array logic 5
71+
* **ci:** debug array logic 6
72+
* **ci:** test hypothesis for env resolve
73+
* **ci:** test hypothesis for env resolve 2
74+
* **ci:** re-add array logic
75+
* **ci:** re-add array logic 2
76+
* **ci:** re-add array logic 3 new env
77+
* **ci:** test hypothesis of esm resolution
78+
* **ci:** try array inside module
79+
* **ci:** try hard code value
80+
* **ci:** log PR_AUTHOR value as-is
81+
* **ci:** remove any special chars from author
82+
* **ci:** strip excess quotes
83+
* **ci:** final solution to strip gh actions additional quotes
84+
* **workflow:** use pr api url
85+
86+
87+
<a name="v1.0.0"></a>
88+
## v1.0.0 - 2022-01-03
89+
### Maintenance
90+
91+
* add action post-release script
92+
93+
94+
[Unreleased]: https://github.com/awslabs/aws-lambda-powertools-python/compare/v1.0.0...HEAD

0 commit comments

Comments
 (0)