Running changelog - #5354
Conversation
| name: Install mbx-ci | ||
| command: | | ||
| curl -Ls https://mapbox-release-engineering.s3.amazonaws.com/mbx-ci/latest/mbx-ci-linux-amd64 > mbx-ci && chmod 755 ./mbx-ci | ||
| mv ./mbx-ci /usr/local/bin/mbx-ci |
There was a problem hiding this comment.
I needed some way to access mbx-ci from scripts/github.js
| task createDependenciesMd { | ||
| doFirst { | ||
| def versions = "- Mapbox Maps SDK v${this.ext.version.mapboxMapSdk} ([release notes](https://github.com/mapbox/mapbox-maps-android/releases/tag/android-v${this.ext.version.mapboxMapSdk})) \n" + | ||
| "- Mapbox Navigation Native v${this.ext.version.mapboxNavigator} \n" + | ||
| "- Mapbox Core Common v${this.ext.version.mapboxCommonNative} \n" + | ||
| "- Mapbox Java v${this.ext.version.mapboxSdkServices} ([release notes](https://github.com/mapbox/mapbox-java/releases/tag/v${this.ext.version.mapboxSdkServices})) \n" + | ||
| "- Mapbox Android Core v${this.ext.version.mapboxCore} \n" + | ||
| "- Mapbox Android Telemetry v${this.ext.version.mapboxEvents} " | ||
| new File(buildDir, "dependencies.md").text = versions | ||
| } |
There was a problem hiding this comment.
Generate a json file instead?
| task createDependenciesMd { | ||
| inputs.properties(this.ext.version) | ||
| outputs.file("$buildDir/dependencies.md") | ||
| doLast { | ||
| def versions = "- Mapbox Maps SDK v${this.ext.version.mapboxMapSdk} ([release notes](https://github.com/mapbox/mapbox-maps-android/releases/tag/android-v${this.ext.version.mapboxMapSdk})) \n" + | ||
| "- Mapbox Navigation Native v${this.ext.version.mapboxNavigator} \n" + | ||
| "- Mapbox Core Common v${this.ext.version.mapboxCommonNative} \n" + | ||
| "- Mapbox Java v${this.ext.version.mapboxSdkServices} ([release notes](https://github.com/mapbox/mapbox-java/releases/tag/v${this.ext.version.mapboxSdkServices})) \n" + | ||
| "- Mapbox Android Core v${this.ext.version.mapboxCore} \n" + | ||
| "- Mapbox Android Telemetry v${this.ext.version.mapboxEvents} " | ||
| new File(buildDir, "dependencies.md").text = versions | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
If some of dependencies transitively updated like here, notes will contain wrong number
| removeEntries() | ||
| updateChangelogMDFile(changelog) | ||
| } | ||
|
|
||
|
|
||
| executor(`git checkout -b add-changelog-${args.version}`) | ||
| executor(`git add .`) | ||
| executor(`git commit -m "created changelog for ${args.version}"`) | ||
| executor(`gh config set prompt disabled`) | ||
| executor(`git push --set-upstream origin add-changelog-${args.version}`) | ||
| executor(`gh pr create --base ${args.branch} --title "Changelog for ${args.version}" --body "" --reviewer mapbox/navigation-android`) | ||
| executor(`gh release create ${args.version} --draft --target ${args.branch} --notes-file ${releaseNotesTempFile} --title ${args.version}`) | ||
| if (args.branch != "main") { | ||
| executor(`git checkout main`) | ||
| executor(`git checkout -b add-changelog-${args.version}-update-main`) | ||
| if (args.isDryRun) { | ||
| console.log("updating changelog at main branch") | ||
| } else { | ||
| updateChangelogMDFile(changelog) | ||
| } | ||
| executor(`git add .`) | ||
| executor(`git commit -m "Changelog for ${args.version}"`) | ||
| executor(`git push origin add-changelog-${args.version}-update-main`) | ||
| executor(`gh pr create --base main --title "Changelog for ${args.version}" --body "" --reviewer mapbox/navigation-android`) | ||
| } | ||
| executor(`git checkout ${args.branch}`) |
There was a problem hiding this comment.
If somebody launches the script from a not main branch, for example release-2.1, script opens 2 PRs with updates in the CHANGELOG.md file, one for the release-2.1 and one for the main branch.
@mapbox/navigation-android , @LukasPaczos , do you like this approach?
Alternatively we can update CHANGELOG.md automatically in the main branch only and update a release branch manually or not to update a release branch at all.
There was a problem hiding this comment.
Hm. Not I'm not sure that this is an approach we use. All our changes go through the master branch and then they're cherry-picked to release branch. 🤔
Guys I need help with this 😄
| executor(`git checkout -b add-changelog-${args.version}`) | ||
| executor(`git add .`) | ||
| executor(`git commit -m "created changelog for ${args.version}"`) | ||
| executor(`gh config set prompt disabled`) | ||
| executor(`git push --set-upstream origin add-changelog-${args.version}`) | ||
| executor(`gh pr create --base ${args.branch} --title "Changelog for ${args.version}" --body "" --reviewer mapbox/navigation-android`) | ||
| executor(`gh release create ${args.version} --draft --target ${args.branch} --notes-file ${releaseNotesTempFile} --title ${args.version}`) | ||
| if (args.branch != "main") { | ||
| executor(`git checkout main`) | ||
| executor(`git checkout -b add-changelog-${args.version}-update-main`) | ||
| if (args.isDryRun) { | ||
| console.log("updating changelog at main branch") | ||
| } else { | ||
| updateChangelogMDFile(changelog) | ||
| } | ||
| executor(`git add .`) | ||
| executor(`git commit -m "Changelog for ${args.version}"`) | ||
| executor(`git push origin add-changelog-${args.version}-update-main`) | ||
| executor(`gh pr create --base main --title "Changelog for ${args.version}" --body "" --reviewer mapbox/navigation-android`) | ||
| } | ||
| executor(`git checkout ${args.branch}`) |
There was a problem hiding this comment.
It would be nice to replace ifs by polymorphism and make the flow testable
| @@ -0,0 +1,2650 @@ | |||
| # Changelog for the Mapbox Navigation SDK for Android | |||
There was a problem hiding this comment.
It should be sufficient to keep just a part of the file, tests never interact with the end of this file anyway
|
I don't like this solution. It seems too complex for this problem. I don't think it's worth having so much js code to support to just solve such a simple issue |
Description
The PR is still draft. I keep it draft because I haven't seriously tested it and want to apply a few more refactoring to make code cleaner. But the majority of the code will stay the same. I'm keen to get feedback from the team now 🙂
Union merge strategy doesn't work in github. To avoid merge conflicts on every CHANGELOG.md I copied @mapbox/navnative's approach.
Keep your changelog entry as a separate json file in the
changelog/unreleasedfolder. Usecreate-changelog-entry.jsscript to add new entries.Update CHANGELOG.md and github releases using
create-changelog-pr.jsscript. It generates changelog for release using files from thechangelog/unreleasedand versions fromdependencies.gradle. After generation it opens a PR(or 2 PR if current branch isn't main) with changelog and creates draft release in the github.TODO: