Skip to content

Running changelog - #5354

Closed
vadzim-vys wants to merge 37 commits into
mainfrom
vv-running-changelog
Closed

Running changelog #5354
vadzim-vys wants to merge 37 commits into
mainfrom
vv-running-changelog

Conversation

@vadzim-vys

@vadzim-vys vadzim-vys commented Jan 11, 2022

Copy link
Copy Markdown
Contributor

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/unreleased folder. Use create-changelog-entry.js script to add new entries.

Update CHANGELOG.md and github releases using create-changelog-pr.js script. It generates changelog for release using files from the changelog/unreleased and versions from dependencies.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:

  • cleanup build.gradle
  • rewrite pr creation script to js
  • support changing of the Changelog.md
  • Fixed formatting
  • limit changelog entry types by added and fixed for validation stage
  • A few release entries per one PR?
  • update Changelog.md in main first
  • make scrip testable, so that I can separate parts locally to verify if they work
  • ticket should be optional in the entry (private repos)
  • test with signed out gh
  • test

Comment thread scripts/changelog-pr.sh Outdated
Comment thread scripts/changelog-pr.sh Outdated
@vadzim-vys vadzim-vys changed the title [Testing-only] Running changelog Running changelog Jan 12, 2022
Comment thread .circleci/config.yml
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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I needed some way to access mbx-ci from scripts/github.js

Comment thread build.gradle Outdated
Comment on lines +110 to +119
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
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Generate a json file instead?

Comment thread build.gradle Outdated
Comment on lines +110 to +122
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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If some of dependencies transitively updated like here, notes will contain wrong number

Comment on lines +44 to +69
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}`)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 😄

Comment on lines +49 to +69
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}`)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It should be sufficient to keep just a part of the file, tests never interact with the end of this file anyway

@vadzim-vys

Copy link
Copy Markdown
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants