android-templates icon indicating copy to clipboard operation
android-templates copied to clipboard

[#525] 1/2 - Create a new workflow to automate the release pull request creation

Open luongvo opened this issue 1 year ago • 1 comments

https://github.com/nimblehq/android-templates/issues/525

What happened 👀

Create a new workflow create_release_pr.yml to automate the Release pull request creation:

  • to be triggered manually when needed.
  • generate the change log as the Release PR content to list all done tasks and PRs from the last tag on the main branch to the latest HEAD on the develop.
  • create the Release PR with the necessary info: title, body, assignee, label, and milestone.

Insight 📝

  • To generate the release change log like our Release PR, use https://github.com/mikepenz/release-changelog-builder-action. It helps us generate the change log from a config file, like what we did with https://github.com/release-drafter/release-drafter from https://github.com/nimblehq/android-templates/pull/245. However, https://github.com/mikepenz/release-changelog-builder-action does not require adding its app to our GitHub organization and can be reused to generate the change log texts for App Distribution release notes or even create releases like release-drafter.

  • To create the pull request by checking out a new release branch from develop, we can NOT use https://github.com/peter-evans/create-pull-request because it requires stage changes to create PR. Instead, I realized we can create PR using GitHub CLI 🤩

    • Before creating the release PR, we must check out a new release branch from the current develop.

    • To fetch corresponding milestone info (assuming the milestone matches the current version name), while GitHub CLI does not support milestone API officially, we can use an extension called https://github.com/valeriobelli/gh-milestone 🤩 This command helps us to get the milestone URL from the milestone name = current version:

      > gh milestone list --query "3.26.0" --json url --jq ".[0].url"  
      https://github.com/luongvo/flutter-survey/milestone/8
      

Proof Of Work 📹

A sample generated Release PR for the current develop 👉 main https://github.com/nimblehq/android-templates/pull/560 🎉

image

Run log: https://github.com/nimblehq/android-templates/actions/runs/6971579676/job/18971937503

luongvo avatar Nov 06 '23 03:11 luongvo

1 Warning
:warning: Uh oh! Your project is under 80% coverage!

Kover report for template-compose:

🧛 Template - Compose Unit Tests Code Coverage: 63.04%

Coverage of Modified Files:

File Coverage

Modified Files Not Found In Coverage Report:

changelog-release.json create_release_pr.yml

Codebase cunningly covered by count Shroud 🧛

Generated by :no_entry_sign: Danger

github-actions[bot] avatar Nov 06 '23 03:11 github-actions[bot]