miya / gh-auto-updater
Installs: 1 764
Dependents: 0
Suggesters: 0
Security: 0
Stars: 45
Watchers: 2
Forks: 1
Open Issues: 2
Requires
- erusev/parsedown: ^1.6
Requires (Dev)
- phpunit/phpunit: ^5.6
This package is not auto-updated.
Last update: 2024-12-21 21:25:52 UTC
README
A composer library for self-hosted WordPress plugin on GitHub with automatic update.
Getting Started
1. The easier way to install this is by using composer.
$ composer require miya/gh-auto-updater
2. Activate automatic update in your WordPress plugin.
<?php
// Autoload
require_once( dirname( __FILE__ ) . '/vendor/autoload.php' );
add_action( 'init', 'activate_autoupdate' );
function activate_autoupdate() {
$plugin_slug = plugin_basename( __FILE__ ); // e.g. `hello/hello.php`.
$gh_user = 'miya0001'; // The user name of GitHub.
$gh_repo = 'gh-auto-updater-example'; // The repository name of your plugin.
// Activate automatic update.
new Miya\WP\GH_Auto_Updater( $plugin_slug, $gh_user, $gh_repo );
}
3. GitHub Access Token (Optional)
You can use personal access token.
define( 'GITHUB_ACCESS_TOKEN', 'xxxxxxxx' );
How to update your plugin.
To release the new version, please do as follows:
1. Tag and push to GitHub.
$ git tag 1.1.0
$ git push origin 1.1.0
1.0.0
is a version number, it have to be same with version number in your WordPress plugin.- You have to commit
vendor
directory in your plugin.
2. Release the new version.
- Please visit "releases" in your GitHub repository.
- Choose a tag.
- Fill out the release note and title.
- Upload your plugin which is comporessed with zip. (Optional)
- Press "Publish release".
Also, you can use automatic release.
Following is an example of the .travis.yml
for automatic release.
https://github.com/miya0001/miya-gallery/blob/master/.travis.yml
You can generate deploy:
section by The Travis Client like following.
$ travis setup releases
Example Projects
Please install old version of following projects, then you can see update notice.
- https://github.com/miya0001/self-hosted-wordpress-plugin-on-github
- https://github.com/miya0001/miya-gallery
These projects deploy new releases automatically with Travis CI.
$ travis setup releases
Please check .travis.yml
and documentation.
Screenshots
Notification on "Plugins" screen in WordPress dashboard.
"Details" screen in WordPress dashboard. You can see release note on GitHub as changelog.
"WordPress Updates" screen.
License
GPL v2