amp-wp icon indicating copy to clipboard operation
amp-wp copied to clipboard

Opt in to receiving non-stable updates

Open pierlon opened this issue 5 years ago • 12 comments

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).

pierlon avatar Oct 19 '19 06:10 pierlon

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 required 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.

pierlon avatar Oct 22 '19 02:10 pierlon

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.

swissspidy avatar Oct 22 '19 08:10 swissspidy

@pierlon Version 1.3.0 of wp-dev-lib is out now.

kasparsd avatar Oct 22 '19 09:10 kasparsd

@pierlon Version 1.3.0 of wp-dev-lib is out now.

Updated develop: https://github.com/ampproject/amp-wp/pull/3589

westonruter avatar Oct 22 '19 12:10 westonruter

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.

@swissspidy, fixed.

pierlon avatar Oct 22 '19 19:10 pierlon

Just to note, an update for the beta plugin will show if both the AMP and beta tester plugins are not active:

image

See https://github.com/ampproject/amp-wp/pull/3560#discussion_r336763645 as to why.

pierlon avatar Oct 22 '19 21:10 pierlon

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.

swissspidy avatar Oct 23 '19 08:10 swissspidy

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.

westonruter avatar Oct 23 '19 11:10 westonruter

Plugin now updates the WP plugins API to reflect the pre-release details; the version code and download URL is updated:

image

pierlon avatar Oct 24 '19 19:10 pierlon

Things to note:

  • Activating the plugin right after installation will only activate AMP
  • Deleting either plugin deletes the folder, so both plugins are deleted

pierlon avatar Oct 24 '19 19:10 pierlon

Awesome work so far, @pierlon !

schlessera avatar Nov 14 '19 10:11 schlessera

All that's left here is to update the tests, and a good code review of course :smile:.

pierlon avatar Dec 06 '19 05:12 pierlon