From 8bdf789553383ff3286544588e1b03ab7349dc47 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Mon, 13 Dec 2021 13:10:36 +0000 Subject: [PATCH] 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 --- .github/workflows/main.yml | 2 +- .github/workflows/newsfile.yml | 20 ++++++++++++++++++++ changelog.d/.gitkeep | 0 changelog.d/96.feature | 1 + config.sample.yml | 5 +++++ pyproject.toml | 29 +++++++++++++++++++++++++++++ scripts/changelog.sh | 3 +++ 7 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/newsfile.yml create mode 100644 changelog.d/.gitkeep create mode 100644 changelog.d/96.feature create mode 100644 pyproject.toml create mode 100755 scripts/changelog.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c3e89e7f..545a3f81 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,4 +56,4 @@ jobs: toolchain: stable profile: minimal - run: yarn - - run: yarn test \ No newline at end of file + - run: yarn test diff --git a/.github/workflows/newsfile.yml b/.github/workflows/newsfile.yml new file mode 100644 index 00000000..b6c65a94 --- /dev/null +++ b/.github/workflows/newsfile.yml @@ -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 diff --git a/changelog.d/.gitkeep b/changelog.d/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/changelog.d/96.feature b/changelog.d/96.feature new file mode 100644 index 00000000..eebeeb21 --- /dev/null +++ b/changelog.d/96.feature @@ -0,0 +1 @@ +Add automatic changelog generation via [Towncrier](https://github.com/twisted/towncrier). diff --git a/config.sample.yml b/config.sample.yml index 66ddf305..1894cfc6 100644 --- a/config.sample.yml +++ b/config.sample.yml @@ -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 # diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..c2390d24 --- /dev/null +++ b/pyproject.toml @@ -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 diff --git a/scripts/changelog.sh b/scripts/changelog.sh new file mode 100755 index 00000000..f30ff4ae --- /dev/null +++ b/scripts/changelog.sh @@ -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