Add towncrier (#96)

* Add support for towncrier

* Use correct command

* Compare properly

* Work within the correct directory

* Try main

* Try a fetch-depth of 0

* changelog

* Fix default config

* Update sample
This commit is contained in:
Will Hunt 2021-12-13 13:10:36 +00:00 committed by GitHub
parent b34130d7ea
commit 8bdf789553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 59 additions and 1 deletions

20
.github/workflows/newsfile.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Newsfile
on:
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with: # Needed for comparison
fetch-depth: 0
- uses: actions/setup-python@v1
with:
python-version: '3.9'
- run: pip install towncrier==19.2.0
- name: ":newspaper: Newsfile"
run: python3 -m towncrier.check --compare-with=origin/main

0
changelog.d/.gitkeep Normal file
View File

1
changelog.d/96.feature Normal file
View File

@ -0,0 +1 @@
Add automatic changelog generation via [Towncrier](https://github.com/twisted/towncrier).

View File

@ -70,6 +70,11 @@ passFile:
# Run openssl genpkey -out passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096 to generate
#
passkey.pem
bot:
# (Optional) Define profile information for the bot user
#
displayname: GitHub Bot
avatar: mxc://half-shot.uk/2876e89ccade4cb615e210c458e2a7a6883fe17d
queue:
# (Optional) Message queue / cache configuration options for large scale deployments
#

29
pyproject.toml Normal file
View File

@ -0,0 +1,29 @@
[tool.towncrier]
filename = "CHANGELOG.md"
directory = "changelog.d"
issue_format = "[\\#{issue}](https://github.com/half-shot/matrix-hookshot/issues/{issue})"
[[tool.towncrier.type]]
directory = "feature"
name = "Features"
showcontent = true
[[tool.towncrier.type]]
directory = "bugfix"
name = "Bugfixes"
showcontent = true
[[tool.towncrier.type]]
directory = "doc"
name = "Improved Documentation"
showcontent = true
[[tool.towncrier.type]]
directory = "removal"
name = "Deprecations and Removals"
showcontent = true
[[tool.towncrier.type]]
directory = "misc"
name = "Internal Changes"
showcontent = true

3
scripts/changelog.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
VERSION=`python3 -c "import json; f = open('./package.json', 'r'); v = json.loads(f.read())['version']; f.close(); print(v)"`
towncrier --version $VERSION $1