Browse Source

Setup towncrier

feature/bma/flipper
Benoit Marty 2 years ago
parent
commit
b2719bc3bc
  1. 9
      .github/workflows/nightly.yml
  2. 0
      CHANGES.md
  3. 3
      app/build.gradle.kts
  4. 1
      changelog.d/.gitignore
  5. 5
      tools/danger/dangerfile.js
  6. 36
      tools/towncrier/template.md
  7. 31
      towncrier.toml

9
.github/workflows/nightly.yml

@ -15,6 +15,15 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install towncrier
run: |
python3 -m pip install towncrier
- name: Prepare changelog file
run: |
mv towncrier.toml towncrier.toml.bak
sed 's/CHANGES\.md/CHANGES_NIGHTLY\.md/' towncrier.toml.bak > towncrier.toml
rm towncrier.toml.bak
yes n | towncrier build --version nightly
- name: Build and upload Nightly APK - name: Build and upload Nightly APK
run: | run: |
./gradlew assembleNightly appDistributionUploadNightly $CI_GRADLE_ARG_PROPERTIES ./gradlew assembleNightly appDistributionUploadNightly $CI_GRADLE_ARG_PROPERTIES

0
CHANGES.md

3
app/build.gradle.kts

@ -93,7 +93,8 @@ android {
firebaseAppDistribution { firebaseAppDistribution {
artifactType = "APK" artifactType = "APK"
// releaseNotesFile = TODO // This file will be generated by the GitHub action
releaseNotesFile = "CHANGES_NIGHTLY.md"
groups = "external-testers" groups = "external-testers"
// This should not be required, but if I do not add the appId, I get this error: // This should not be required, but if I do not add the appId, I get this error:
// "App Distribution halted because it had a problem uploading the APK: [404] Requested entity was not found." // "App Distribution halted because it had a problem uploading the APK: [404] Requested entity was not found."

1
changelog.d/.gitignore vendored

@ -0,0 +1 @@
!.gitignore

5
tools/danger/dangerfile.js

@ -43,7 +43,6 @@ if (requiresChangelog) {
"doc", "doc",
"feature", "feature",
"misc", "misc",
"sdk",
"wip", "wip",
] ]
if (!changelogFiles.every(file => validTowncrierExtensions.includes(file.split(".").pop()))) { if (!changelogFiles.every(file => validTowncrierExtensions.includes(file.split(".").pop()))) {
@ -68,13 +67,10 @@ const signOff = "Signed-off-by:"
// Please add new names following the alphabetical order. // Please add new names following the alphabetical order.
const allowList = [ const allowList = [
"amitkma",
"aringenbach", "aringenbach",
"BillCarsonFr", "BillCarsonFr",
"bmarty", "bmarty",
"Claire1817",
"dependabot[bot]", "dependabot[bot]",
"ericdecanini",
"fedrunov", "fedrunov",
"Florian14", "Florian14",
"ganfra", "ganfra",
@ -86,7 +82,6 @@ const allowList = [
"manuroe", "manuroe",
"mnaturel", "mnaturel",
"onurays", "onurays",
"ouchadam",
"stefanceriu", "stefanceriu",
"yostyle", "yostyle",
] ]

36
tools/towncrier/template.md

@ -0,0 +1,36 @@
{% if top_line %}
{{ top_line }}
{{ top_underline * ((top_line)|length)}}
{% elif versiondata.name %}
{{ versiondata.name }} {{ versiondata.version }} ({{ versiondata.date }})
{{ top_underline * ((versiondata.name + versiondata.version + versiondata.date)|length + 4)}}
{% else %}
{{ versiondata.version }} ({{ versiondata.date }})
{{ top_underline * ((versiondata.version + versiondata.date)|length + 3)}}
{% endif %}
{% for section, _ in sections.items() %}
{% set underline = underlines[0] %}{% if section %}{{section}}
{{ underline * section|length }}{% set underline = underlines[1] %}
{% endif %}
{% if sections[section] %}
{% for category, val in definitions.items() if category in sections[section]%}
{{ definitions[category]['name'] }}
{{ underline * definitions[category]['name']|length }}
{% if definitions[category]['showcontent'] %}
{% for text, values in sections[section][category].items() %}
- {{ text }} ({{ values|join(', ') }})
{% endfor %}
{% else %}
- {{ sections[section][category]['']|join(', ') }}
{% endif %}
{% if sections[section][category]|length == 0 %}
No significant changes.
{% else %}
{% endif %}
{% endfor %}
{% else %}
No significant changes.
{% endif %}
{% endfor %}

31
towncrier.toml

@ -0,0 +1,31 @@
[tool.towncrier]
directory = "changelog.d"
filename = "CHANGES.md"
name = "Changes in Element X"
template = "tools/towncrier/template.md"
issue_format = "[#{issue}](https://github.com/vector-im/element-x-android/issues/{issue})"
[[tool.towncrier.type]]
directory = "feature"
name = "Features ✨"
showcontent = true
[[tool.towncrier.type]]
directory = "bugfix"
name = "Bugfixes 🐛"
showcontent = true
[[tool.towncrier.type]]
directory = "wip"
name = "In development 🚧"
showcontent = true
[[tool.towncrier.type]]
directory = "doc"
name = "Improved Documentation 📚"
showcontent = true
[[tool.towncrier.type]]
directory = "misc"
name = "Other changes"
showcontent = true
Loading…
Cancel
Save