Skip to content

Commit de80950

Browse files
committed
Add update checks via GitHub releases
1 parent 386d45f commit de80950

5 files changed

Lines changed: 74 additions & 6 deletions

File tree

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"leonstafford/wp2staticguzzle": "^7.2.0",
2929
"ext-mbstring": "*",
3030
"ext-simplexml": "*",
31-
"lib-libxml": "*"
31+
"lib-libxml": "*",
32+
"yahnis-elsts/plugin-update-checker": "^5.6"
3233
},
3334
"require-dev": {
3435
"thecodingmachine/phpstan-strict-rules": "*",

composer.lock

Lines changed: 54 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Controller.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public static function init( string $bootstrap_file ) : Controller {
3939
$plugin_instance = self::getInstance();
4040

4141
WordPressAdmin::registerHooks( $bootstrap_file );
42+
WordPressAdmin::buildUpdateChecker( $bootstrap_file );
4243
WordPressAdmin::addAdminUIElements();
4344

4445
Utils::set_max_execution_time();

src/WordPressAdmin.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace WP2Static;
1111

12+
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;
13+
1214
class WordPressAdmin {
1315

1416
/**
@@ -18,6 +20,19 @@ public function __construct() {
1820

1921
}
2022

23+
/**
24+
* Build update checker
25+
*
26+
* @param string $bootstrap_file main plugin filepath
27+
*/
28+
public static function buildUpdateChecker( string $bootstrap_file ) : void {
29+
PucFactory::buildUpdateChecker(
30+
'https://raw.githubusercontent.com/staticweb-io/wp2static/refs/heads/develop/update.json',
31+
$bootstrap_file,
32+
'wp2static'
33+
);
34+
}
35+
2136
/**
2237
* Register hooks for WordPress and WP2Static actions
2338
*

update.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"new_version": "7.3.0",
2+
"name": "WP2Static",
3+
"version": "7.3.0",
34
"download_url": "https://github.com/staticweb-io/wp2static/releases/download/v7.3.0/plugin.zip",
45
"requires": "6.4",
56
"tested": "6.4"

0 commit comments

Comments
 (0)