Fix automated release notes (changelog) for fastlane.
This code change fixes the logic for creating changelog MR that is still triggered with every build.
This logic is currently creating the changelog for a new version, but it doesn't use that changelog when it's building artifacts.
The process
Important terms
-
VERSION_CODE
- Different name for the GitLab CI pipeline ID. Used as an unique version for each build -
fastlane/metadata/android/en-GB/changelogs/<'CURRENT_VERSION'|$VERSION_NUMBER>.txt
- these are files with the changelog entries
There are a few critical steps that need to happen for creating a new changelog.
- Create
${VERSION_CODE}.txt
file with content fromCURRENT_VERISION.txt
- Create an MR with this code change
- Build an app
The issue
The current code has an issue because it does the following:
- Create
${VERSION_CODE}.txt
file with content fromCURRENT_VERISION.txt
- Commits this change into a new branch
- Create an MR with this code change
-
git checkout <original commit>
this removes the${VERSION_CODE}.txt
file which was supposed to be used by fastlane to populate release notes - Build an app
The MR gets created, but the changelog is not used in the build
The fix
- We only create the changelog MR on tag pipelines
- We only allow promoting release to production on tag pipelines
- We use a separate build step to create the MR to prevent race conditions
- We create empty
CURRENT_VERSION.txt
so we prevent showing the same change in multiple changelogs- https://gitlab.com/gitlab-org/gitter/gitter-android-app/-/blob/master/fastlane/metadata/android/en-GB/changelogs/352.txt
- https://gitlab.com/gitlab-org/gitter/gitter-android-app/-/blob/master/fastlane/metadata/android/en-GB/changelogs/334.txt
- https://gitlab.com/gitlab-org/gitter/gitter-android-app/-/blob/master/fastlane/metadata/android/en-GB/changelogs/333.txt
- https://gitlab.com/gitlab-org/gitter/gitter-android-app/-/blob/master/fastlane/metadata/android/en-GB/changelogs/331.txt
Tested
Tested in with the previous commit:
- pipeline: https://gitlab.com/gitlab-org/gitter/gitter-android-app/pipelines/129989728
- created MR: https://gitlab.com/gitlab-org/gitter/gitter-android-app/-/merge_requests/157
- (the changelog MR contains the commits from this MR, that is expected and won't be an issue when only run on master)
Edited by Tomas Vik