google-listings-and-ads
google-listings-and-ads copied to clipboard
Automatic check for migration version replace
When we release a new DB migration we must specify which version the migration applies to. We added a step in our release Wiki to ensure this is replaced upon release:
- If there are new database migration classes (under
src/DB/Migration/
) modify their applicable version set in theget_applicable_version
class of each migration class to be the same value as the version that is to be released.
Woorelease doesn't replace this version since it looks specifically for a matching @since
or @version
tag. So we need to replace it manually as one of the steps to release.
However in the release of version 1.12.0 it was missed (wasn't caught in 1.12.1 either), meaning the migration didn't run for any user updating the plugin. In this case the migration code is minimal so sites should continue functioning without issues and we can have it run for 1.12.2.
However I think we should address this with an automatic check. Maybe a script which runs upon release and detects that Woorelease is being called, which fails if the version hasn't been replaced yet, or auto replaces it.
The other day I was looking into some code in WC Gutenberg blocks and I realize that they have one variable named $version
that seems that is replaced automatically. See line.
I am not sure if the replacement is made by Woorelase or if there is something else doing this.
We don't use a -dev
suffix in the develop branch, although we could adopt that strategy (WC does the same) since that would give us a specific version to put into the migration script.
Either way they seem to use a shell script to replace the version: https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/trunk/bin/version-changes.sh#L19
What do you think about adding a feature to WooRealese, so it will replace x.x.x
in other places indicated by something like // WRCS: RELEASED_VERSION
, to follow what it does for the "latest" version https://github.com/woocommerce/woorelease/blob/trunk/includes/tools/class-version-bump.php#L165-L183 ?
I think it's a great suggestion to have an option of using WooRelease to replace the version string. Although we'd have to look a little more at what would be the right way to indicate what to replace in the code.
Using the comment // WRCS: RELEASED_VERSION
means WooRelease would have to replace the version and remove the comment, because we don't want it to be detected again in the next release. Unless we specifically only replace x.x.x
with a matching comment, but then the remaining comment would seem out of place.
Update
We've added a reminder in the "prepare release" workflow to ensure it isn't forgotten during release.
An improvement but still no automatic replacement so I'm leaving this issue open.
Seems to me a good option for cooldowns/hackathons if it's not anymore high priority