Add "new version" banners on release

This commit is contained in:
Anton Medvedev 2023-01-10 14:43:43 +01:00
parent a809e82459
commit f6e6dbde48
2 changed files with 31 additions and 9 deletions

View File

@ -1,4 +1,5 @@
import:
- src/Support/update_banner.php
- src/Support/update_manifest.php
hosts:
@ -7,16 +8,14 @@ hosts:
config:
banner: |
╭──────────────────────────────────────────────────────╮
│ │
│ Update available! Mode info ï.at/update │
│ │
╰──────────────────────────────────────────────────────╯
╭────────────────────────────────────────────╮
│ │
│ Update available! More info at │
│ https://ï.at/deployer-releases │
│ │
╰────────────────────────────────────────────╯
tasks:
release:
- update_banner
- update_manifest
create_banner:
- desc: Create an update banner
- run: echo $'{{banner}}' > {{site}}/check-updates/{{old_version}}

View File

@ -0,0 +1,23 @@
<?php declare(strict_types=1);
/* (c) Anton Medvedev <anton@medv.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Deployer;
task('update_banner', function () {
$skipCurrentVersion = get('version');
$manifestPath = '~/deployer.org/artifacts/manifest.json';
$manifest = json_decode(run("cat $manifestPath"), true);
$commands = '';
foreach ($manifest as $m) {
if ($skipCurrentVersion === $m['version']) {
continue;
}
$commands .= "echo -n '{{banner}}' > ~/deployer.org/check-updates/{$m['version']};\n";
}
run($commands);
});