Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let GitHub generates the release notes #3105

Merged
merged 13 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Uncomment this markdown table below and edit the last line `|||`:
- [ ] UI change has been tested on both light and dark themes
- [ ] Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
- [ ] Pull request is based on the develop branch
- [ ] Pull request includes a new file under ./changelog.d. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#changelog
- [ ] Pull request title will be used in the release note, it clearly define what will change for the user
Copy link
Member

@jmartinesp jmartinesp Jun 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention the usage of labels here too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Danger will complain if the label is missing, so I do not think it worth it. Also I do not think external contributors using forks can add labels (not sure about this).

- [ ] Pull request includes screenshots or videos if containing UI changes
- [ ] Pull request includes a [sign off](https://matrix-org.github.io/synapse/latest/development/contributing_guide.html#sign-off)
- [ ] You've made a self review of your PR
34 changes: 34 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
changelog:
categories:
- title: ✨ Features
labels:
- PR-Feature
- title: 🙌 Improvements
labels:
- PR-Change
- title: 🐛 Bugfixes
labels:
- PR-Bugfix
- title: ⚠️ API Changes
labels:
- PR-Api
- title: 🗣 Translations
labels:
- PR-i18n
- title: 🧱 Build
labels:
- PR-Build
- title: 📄 Documentation
labels:
- PR-Doc
- title: 🚧 In development 🚧
labels:
- PR-Wip
- title: Dependency upgrades
labels:
- PR-Dependencies

- title: Others
labels:
- PR-misc
- "*"
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"config:base"
],
"labels" : [
"dependencies"
"PR-Dependencies"
],
"ignoreDeps" : [
"string:app_name"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fork-pr-notice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
body: `Thank you for your contribution! Here are a few things to check in the PR to ensure it's reviewed as quickly as possible:

- Your branch should be based on \`origin/develop\`, at least when it was created.
- There is a changelog entry in the \`changelog.d\` folder with [the Towncrier format](https://towncrier.readthedocs.io/en/latest/tutorial.html#creating-news-fragments).
- The title of the PR will be used for release notes, so it needs to describe the change visible to the user.
- The test pass locally running \`./gradlew test\`.
- The code quality check suite pass locally running \`./gradlew runQualityChecks\`.
- If you modified anything related to the UI, including previews, you'll have to run the \`Record screenshots\` GH action in your forked repo: that will generate compatible new screenshots. However, given Github Actions limitations, **it will prevent the CI from running temporarily**, until you upload a new commit after that one. To do so, just pull the latest changes and push [an empty commit](https://coderwall.com/p/vkdekq/git-commit-allow-empty).`
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ jobs:
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
- 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 application
run: |
./gradlew assembleGplayNightly appDistributionUploadGplayNightly $CI_GRADLE_ARG_PROPERTIES
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sync-localazy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ jobs:
- Update Strings from Localazy
branch: sync-localazy
base: develop
labels: PR-i18n
1 change: 1 addition & 0 deletions .github/workflows/sync-sas-strings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ jobs:
- Update SAS Strings from matrix-doc.
branch: sync-sas-strings
base: develop
labels: PR-Misc


14 changes: 2 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,9 @@ This project is full Kotlin. Please do not write Java classes.

### Changelog

Please create at least one file under ./changelog.d containing details about your change. Towncrier will be used when preparing the release.
The release notes are generated from the pull request titles and labels. If possible, the title must describe best what will be the user facing change.

Towncrier says to use the PR number for the filename, but the issue number is also fine.

Supported filename extensions are:

- ``.feature``: Signifying a new feature in Element Android or in the Matrix SDK.
- ``.bugfix``: Signifying a bug fix.
- ``.wip``: Signifying a work in progress change, typically a component of a larger feature which will be enabled once all tasks are complete.
- ``.doc``: Signifying a documentation improvement.
- ``.misc``: Any other changes.

See https://github.com/twisted/towncrier#news-fragments if you need more details.
You will also need to add a label starting by `PR-` to you Pull Request to help categorize the release note. The label should be added by the PR author, but can be added by the reviewer if the submitter does not have right to add label. Also note that the label can be added after the PR has been merged, as soon as the release is not done yet.

### Code quality

Expand Down
4 changes: 1 addition & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ android {
artifactPath = "$rootDir/app/build/outputs/apk/gplay/nightly/app-gplay-universal-nightly.apk"
// artifactType = "AAB"
// artifactPath = "$rootDir/app/build/outputs/bundle/nightly/app-nightly.aab"
// This file will be generated by the GitHub action
releaseNotesFile = "CHANGES_NIGHTLY.md"
releaseNotesFile = "tools/release/ReleaseNotesNightly.md"
groups = "external-testers"
// 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."
Expand Down Expand Up @@ -213,7 +212,6 @@ knit {
exclude(
"**/build/**",
"*/.gradle/**",
"*/towncrier/template.md",
"**/CHANGES.md",
)
}
Expand Down
2 changes: 1 addition & 1 deletion docs/danger.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Here are the checks that Danger does so far:

- PR description is not empty
- Big PR got a warning to recommend to split
- PR contains a file for towncrier and extension is checked
- PR contains a correct title and a label to categorize the release note
- PR does not modify frozen classes
- PR contains a Sign-Off, with exception for Element employee contributors
- PR with change on layout should include screenshot in the description (TODO Not supported yet!)
Expand Down
4 changes: 0 additions & 4 deletions docs/nightly_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ Then you can run the following commands (which are also used in the file for [th

```sh
git checkout develop
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
./gradlew assembleGplayNightly appDistributionUploadGplayNightly $CI_GRADLE_ARG_PROPERTIES
```

Expand Down
30 changes: 7 additions & 23 deletions tools/danger/dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,14 @@ if (editedFiles.length > 50) {
message("This pull request seems relatively large. Please consider splitting it into multiple smaller ones.")
}

// Request a changelog for each PR
const changelogAllowList = [
"dependabot[bot]",
]
// Request a correct title for each PR
if (pr.title.endsWith("…")) {
fail("Please provide a complete title that can be used as a changelog entry.")
}

const requiresChangelog = !changelogAllowList.includes(user)

if (requiresChangelog) {
const changelogFiles = editedFiles.filter(file => file.startsWith("changelog.d/"))

if (changelogFiles.length == 0) {
warn("Please add a changelog. See instructions [here](https://github.com/element-hq/element-android/blob/develop/CONTRIBUTING.md#changelog)")
} else {
const validTowncrierExtensions = [
"bugfix",
"doc",
"feature",
"misc",
"wip",
]
if (!changelogFiles.every(file => validTowncrierExtensions.includes(file.split(".").pop()))) {
fail("Invalid extension for changelog. See instructions [here](https://github.com/element-hq/element-android/blob/develop/CONTRIBUTING.md#changelog)")
}
}
// Request a `PR-` label for each PR
if (pr.labels.filter((label) => label.name.startsWith("PR-")).length != 1) {
fail("Please add a `PR-` label to categorise the changelog entry.")
}

// check that frozen classes have not been modified
Expand Down
5 changes: 5 additions & 0 deletions tools/release/ReleaseNotesNightly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Element X Android nightly build

See which PRs have been merged recently here:

https://github.com/element-hq/element-x-android/pulls?q=is%3Apr+sort%3Aupdated-desc+is%3Aclosed
50 changes: 23 additions & 27 deletions tools/release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,6 @@ rm ${versionsFileBak}
# This commit may have no effect because generally we do not change the version during the release.
git commit -a -m "Setting version for the release ${version}"

printf "\n================================================================================\n"
printf "Running towncrier...\n"
yes | towncrier build --version "v${version}"

printf "\n================================================================================\n"
read -p "Check the file CHANGES.md consistency. It's possible to reorder items (most important changes first) or change their section if relevant. Also an opportunity to fix some typo, or rewrite things. Do not commit your change. Press enter to continue. "

printf "\n================================================================================\n"
printf "Committing...\n"
git commit -a -m "Changelog for version ${version}"

printf "\n================================================================================\n"
printf "Creating fastlane file...\n"
printf -v versionMajor2Digits "%02d" "${versionMajor}"
Expand Down Expand Up @@ -198,17 +187,6 @@ read -p "I have updated the versions to prepare the next release, please check t
printf "Committing...\n"
git commit -a -m 'version++'

printf "\n================================================================================\n"
read -p "Done, push the branch 'develop' (yes/no) default to yes? (A rebase may be necessary in case develop got new commits) " doPush
doPush=${doPush:-yes}

if [ "${doPush}" == "yes" ]; then
printf "Pushing branch 'develop'...\n"
git push origin develop
else
printf "Not pushing, do not forget to push manually!\n"
fi

printf "\n================================================================================\n"
printf "Wait for the GitHub action https://github.com/element-hq/element-x-android/actions/workflows/release.yml?query=branch%%3Amain to build the 'main' branch.\n"
printf "Please enter the url of the github action (!!! WARNING: NOT THE URL OF THE ARTIFACT ANYMORE !!!)\n"
Expand Down Expand Up @@ -380,19 +358,37 @@ printf "You can then go to \"Publishing overview\" and send the new release for
read -p "Press enter to continue. "

printf "\n================================================================================\n"
# Url encode for "<!-- Copy paste the section of the file CHANGES.md for this release here -->"
body="%3C%21--%20Copy%20paste%20the%20section%20of%20the%20file%20CHANGES.md%20for%20this%20release%20here%20--%3E"
githubCreateReleaseLink="https://github.com/element-hq/element-x-android/releases/new?tag=v${version}&title=Element%20X%20Android%20v${version}&body=${body}"
githubCreateReleaseLink="https://github.com/element-hq/element-x-android/releases/new?tag=v${version}&title=Element%20X%20Android%20v${version}"
printf "Creating the release on gitHub.\n"
printf -- "Open this link: %s\n" "${githubCreateReleaseLink}"
printf "Then\n"
printf " - copy paste the section of the file CHANGES.md for this release.\n"
printf " - click on the 'Generate releases notes' button.\n"
printf " - Click on the 'Generate releases notes' button.\n"
printf " - Optionally reorder items and fix typos.\n"
printf " - Add the file ${signedBundlePath} to the GitHub release.\n"
printf " - Add the universal APK, downloaded from the GooglePlay console to the GitHub release.\n"
printf " - Add the 4 signed APKs for F-Droid, located at ${fdroidTargetPath} to the GitHub release.\n"
read -p ". Press enter to continue. "

printf "\n================================================================================\n"
printf "Update the project release notes:\n\n"

read -p "Copy the content of the release note generated by GitHub to the file CHANGES.md and press enter to commit the change. \n"

printf "\n================================================================================\n"
printf "Committing...\n"
git commit -a -m "Changelog for version ${version}"

printf "\n================================================================================\n"
read -p "Done, push the branch 'develop' (yes/no) default to yes? (A rebase may be necessary in case develop got new commits) " doPush
doPush=${doPush:-yes}

if [ "${doPush}" == "yes" ]; then
printf "Pushing branch 'develop'...\n"
git push origin develop
else
printf "Not pushing, do not forget to push manually!\n"
fi

printf "\n================================================================================\n"
printf "Message for the Android internal room:\n\n"
message="@room Element X Android ${version} is ready to be tested. You can get it from https://github.com/element-hq/element-x-android/releases/tag/v${version}. You can install the universal APK. If you want to install the application from the app bundle, you can follow instructions [here](https://github.com/element-hq/element-x-android/blob/develop/docs/install_from_github_release.md). Please report any feedback. Thanks!"
Expand Down
36 changes: 0 additions & 36 deletions tools/towncrier/template.md

This file was deleted.

31 changes: 0 additions & 31 deletions towncrier.toml

This file was deleted.

Loading