Skip to content

Add GitHub Actions based release automation #1400

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

Merged
merged 5 commits into from
Jun 14, 2024

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented May 24, 2024

This PR adds a GitHub Actions Workflow to create releases. The process is as follows:

  • Users with write access trigger a new workflow run for the "Release new version" workflow, entering the version to be released
  • The automation does some sanity checks on the branch name:
    ** Release <major>.<minor>.0 must be released from the maintenance branch (i.e. <major>.<minor>.x) or the master branch. If the master branch is selected, the automation will attempt to create a new maintenance branch
    ** Release <major>.<minor>.<patch> must be released from the maintenance branch (i.e. <major>.<minor>.x) - releasing from any other branches is not allowed
  • The automation then updates the build version to <major>.<minor>.<patch> in build.gradle, commits this change and creates a tag
  • After tagging, the version in build.gradle is updated to <major>.<minor>.<patch+1>-SNAPSHOT and again committed
  • The maintenance branch and tag are pushed to the repository
  • A draft release with generated release notes is created

I've tested the flow in my fork where I've confirmed it works. However, a couple of changes may be appropriate still:

  • The automation currently uses the GitHub token of the user triggering the release. Since commits are being pushed directly, branch protection rules may interfere with the release process. In this case, we should add the mongodb-dbx-release-bot app to the repository and generate a token for the app. We can then allow the app to bypass branch protections
  • If not all users with write access should have permission to create releases, we can set up an environment in GitHub settings and require that an authorised user approves the workflow run
  • The release commits and tag are not signed; this could be added using the git-sign action
  • Other release requirements related to the SSDLC effort (e.g. generating a SAST report, uploading SBOM, etc.) are not added yet and can be integrated based on the shared driver's GitHub Actions once they are ready.

Any additional build tasks (e.g. creating a package to upload to a package manager) can be done in a separate workflow that runs when a tag is pushed.

JAVA-5479

@alcaeus alcaeus requested review from rozza and jyemin May 24, 2024 07:54

env:
GH_TOKEN: ${{ github.token }}
# TODO: Adding the mongodb-dbx-release-automation app to the repository will allow fetching a one-time token and pushing
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like a necessary thing to enable in the initial version, as we do have branch protection rules enabled.

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct. In that case, you should follow these instructions (internal link) to request the mongodb-dbx-release-bot application to be added to all relevant repositories.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Requested

Copy link
Member

Choose a reason for hiding this comment

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

🍿 Is this the last blocker?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is - just waiting for our IT to enable the app here, then we're good to go :)

@jyemin
Copy link
Collaborator

jyemin commented Jun 3, 2024

Is there anything the blocks taking this out of Draft?

@alcaeus alcaeus force-pushed the release-automation branch from 093940e to b87eaa1 Compare June 4, 2024 07:11
@alcaeus alcaeus marked this pull request as ready for review June 4, 2024 07:11
@alcaeus
Copy link
Member Author

alcaeus commented Jun 4, 2024

Is there anything the blocks taking this out of Draft?

Not really. I've rebased on top of master and added the release environment, which allows us to better protect the necessary credentials and also allows for adding additional checks (such as directly restricting which branches can be released).
Once the app has been added to the repository, we're good to start testing.

@alcaeus alcaeus force-pushed the release-automation branch from 40f11da to 638c1d8 Compare June 14, 2024 06:41
@alcaeus alcaeus requested a review from jyemin June 14, 2024 06:43
Copy link
Collaborator

@jyemin jyemin left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

@jyemin jyemin merged commit b8170a3 into mongodb:master Jun 14, 2024
56 of 59 checks passed
@jyemin jyemin changed the title JAVA-5479: Add GitHub Actions based release automation Add GitHub Actions based release automation Jun 14, 2024
@alcaeus alcaeus deleted the release-automation branch June 20, 2024 11:29
jyemin pushed a commit to jyemin/mongo-java-driver that referenced this pull request Sep 4, 2024
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.

3 participants