amp-wp
amp-wp copied to clipboard
Opt in to receiving non-stable updates
Summary
This PR adds a plugin called "AMP Beta Tester" to opt-in to receiving updates released on GitHub.
Addresses issue #2084.
To-do:
- [x] Hide plugin updates if working from source
- [x] Force WP to do a plugin update check on plugin activation (this allows for the plugin update cache to be modified)
- [x] Remove any plugin data and restore plugin update cache on deactivation
- [x] Update plugin details to reflect that of GitHub release
- [x] Move plugin to the correct folder when updated
- [x] Add an option to control auto updating of the plugin
- [x] Update tests for relevant sections of code
Checklist:
- [x] My pull request is addressing an open issue (please create one otherwise).
- [x] My code is tested and passes existing tests.
- [x] My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).
At the moment, the plugin works as intended; that is, upgrading the AMP plugin to the latest non-stable release on GitHub. Things to note:
-
Upgrading will remove the plugin directory
-
Upgrading to 1.4.0-beta1 is not recommended, since it does not include this plugin
Regarding the failing tests, the main blocker is that files are not being require
d correctly due to a problem with having multiple plugin files in one directory (see PR at https://github.com/xwp/wp-dev-lib/pull/307). I'm currently waiting on @kasparsd's approval so that it can get merged and released as a minor update.
Upgrading to
1.4.0-beta1
is not recommended, since it does not include this plugin
When I am running the current beta / develop
branch, does it even suggest upgrading to 1.4.0-beta1
? If so, that sounds wrong.
@pierlon Version 1.3.0 of wp-dev-lib is out now.
@pierlon Version 1.3.0 of wp-dev-lib is out now.
Updated develop
: https://github.com/ampproject/amp-wp/pull/3589
Upgrading to
1.4.0-beta1
is not recommended, since it does not include this pluginWhen I am running the current beta /
develop
branch, does it even suggest upgrading to1.4.0-beta1
? If so, that sounds wrong.
@swissspidy, fixed.
Just to note, an update for the beta plugin will show if both the AMP and beta tester plugins are not active:
See https://github.com/ampproject/amp-wp/pull/3560#discussion_r336763645 as to why.
Lots of great progress here, really awesome to see! 🎉
Just to note, an update for the beta plugin will show if both the AMP and beta tester plugins are not active:
I think the AMP Beta Tester plugin should just have the same version number as the plugin then to solve this.
When the user has the AMP Beta Tester plugin active, what about automatically updating them to the latest pre-release version? See https://github.com/ampproject/amp-wp/issues/2487. Perhaps this should be an opt-in setting? Probably better to be opt-in because sometimes you'll make a plugin build from a branch and you'll want to test that specifically, and it would be undesirable to have the plugin update itself unexpectedly.
(Alternatively, we could change the logic for generating the plugin version number to include the current branch name if not develop
and only auto-update if a branch build is currently active.)
Perhaps the auto-update functionality should actually be a setting in the main plugin itself, so if the AMP Beta Tester plugin is active then the user will keep on the latest pre-release version. And if the AMP Beta Tester plugin is not active then it could keep them up-to-date to the latest stable version.
Plugin now updates the WP plugins API to reflect the pre-release details; the version code and download URL is updated:
Things to note:
- Activating the plugin right after installation will only activate AMP
- Deleting either plugin deletes the folder, so both plugins are deleted
Awesome work so far, @pierlon !
All that's left here is to update the tests, and a good code review of course :smile:.