mirror of
https://github.com/deployphp/deployer.git
synced 2025-01-17 21:48:58 +01:00
Add "new version" banners on release
This commit is contained in:
parent
a809e82459
commit
f6e6dbde48
17
deploy.yaml
17
deploy.yaml
@ -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}}
|
||||
|
23
src/Support/update_banner.php
Normal file
23
src/Support/update_banner.php
Normal 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);
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user