Skip to content

PHPC-1674: Automate Driver Releases #1538

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 29 commits into from
May 3, 2024
Merged

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Apr 18, 2024

PHPC-1674

This PR adds release automation to reduce the number of manual steps required for the release. Manual steps are now limited to branch management (i.e. creating a new version branch before releasing a minor version) and merging up release commits. The commit process (e.g. changing to a stable version number in phongo_version.h), tagging a release, and building release artifacts including a PECL archive are now automated.

Signing release artifacts will be part of a separate PR.

Todo list:

  • Support filling in release notes in make package.xml
  • Build PECL package when a tag is pushed
  • Build Windows DLLs when a tag is pushed
  • TBD: Generate changelog
  • Create release tag automatically (including changes to phongo_version.h)
  • Create draft release

@alcaeus alcaeus self-assigned this Apr 18, 2024
Copy link
Member Author

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

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

@jmikola left some explanatory comments in here. I still need to figure out why the changelog is not read correctly from the tag (it reads the message of the underlying commit instead of the message of the annotated tag), but other than that this is ready for a first look.

I revamped the release documentation significantly but left it in the current place. Once you've looked through and it looks good, I'd extract the release documentation to a RELEASING.md file as we've done for PHPLIB.

- name: "Read changelog from draft release"
run: gh release view ${{ env.PACKAGE_VERSION }} --json body --template '{{ .body }}' >> changelog

# TODO: Sign tag
Copy link
Member Author

Choose a reason for hiding this comment

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

This will be done in a later step as we currently don't have the signing infrastructure in place.

run-name: "Release ${{ inputs.version }}"

on:
workflow_dispatch:
Copy link
Member Author

Choose a reason for hiding this comment

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

workflow_dispatch allows a manual trigger by anyone with write access to the repository. If we want to limit the number of people that can start a release, we'd have to add checks in this workflow, but I don't think that's necessary at this point.

./bin/update-release-version.php patch
git commit -m "Back to -dev" phongo_version.h

# TODO: Manually merge using ours strategy. This avoids merge-up pull requests being created
Copy link
Member Author

Choose a reason for hiding this comment

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

I'll defer this to a separate PR as it requires some work to make this logic from the merge-up action reusable here.

Copy link
Member

Choose a reason for hiding this comment

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

Reminder to ticket this if needed so we don't lose track of it.

I assume we already have a ticket to track the earlier TODO for release signing.

Copy link
Member Author

Choose a reason for hiding this comment

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

CONTRIBUTING.md Outdated
conflict, follow the "Ignoring Changes" section in the pull request to resolve
the conflicts and merge the pull request once the build completes.

### Manual release process
Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to keep the old documentation in place for the time being - the release workflow currently supports stable releases but no pre-releases. I plan to add support for pre-releases as well as that will be necessary when 2.0 comes around.

@@ -22,7 +22,7 @@
* publishing a release. */

/* clang-format off */
#define PHP_MONGODB_VERSION "1.18.2-dev"
#define PHP_MONGODB_VERSION "1.18.2dev"
Copy link
Member Author

Choose a reason for hiding this comment

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

During testing, I was trying to create a package with devel stability and PECL complained that the -dev suffix is wrong. I dislike that difference, but hopefully it won't be much longer until we can finally say goodbye to pecl.

@alcaeus alcaeus marked this pull request as ready for review April 25, 2024 12:13
@jmikola jmikola self-requested a review April 26, 2024 16:11
# PECL always uses the version for the package name.
# Read it from the version file and store in env to use when uploading artifacts
- name: "Read current package version"
run: echo "PACKAGE_VERSION=$(./bin/update-release-version.php version)" >> "$GITHUB_ENV"
Copy link
Member

Choose a reason for hiding this comment

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

You appear to only reference ${{ env.PACKAGE_VERSION }} when constructing the tgz filename. Why not store the generated package filename as an environment variable?

Copy link
Member Author

Choose a reason for hiding this comment

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

I looked at that initially, but couldn't figure out the correct shell syntax to only print the filename of the generated file. Relying on the naming convention in combination with extracting the version number seemed like a sensible alternative.

* Fix wrong version number format
* Clarify manual release process steps
* Add section on announcing releases
* Fix wrong heading level
@alcaeus alcaeus requested a review from jmikola April 29, 2024 12:21
@alcaeus alcaeus requested a review from jmikola April 30, 2024 07:19
Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

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

A couple of questions to address but LGTM with or without changes.

./bin/update-release-version.php patch
git commit -m "Back to -dev" phongo_version.h

# TODO: Manually merge using ours strategy. This avoids merge-up pull requests being created
Copy link
Member

Choose a reason for hiding this comment

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

Reminder to ticket this if needed so we don't lose track of it.

I assume we already have a ticket to track the earlier TODO for release signing.

@alcaeus alcaeus requested a review from jmikola May 2, 2024 11:24
@alcaeus alcaeus merged commit 7142daf into mongodb:v1.18 May 3, 2024
@alcaeus alcaeus deleted the release-tooling branch May 3, 2024 08:20
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