Skip to content

Commit f6e6dbd

Browse files
committed
Add "new version" banners on release
1 parent a809e82 commit f6e6dbd

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

deploy.yaml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import:
2+
- src/Support/update_banner.php
23
- src/Support/update_manifest.php
34

45
hosts:
@@ -7,16 +8,14 @@ hosts:
78

89
config:
910
banner: |
10-
╭──────────────────────────────────────────────────────╮
11-
│ │
12-
│ Update available! Mode info ï.at/update │
13-
│ │
14-
╰──────────────────────────────────────────────────────╯
11+
╭────────────────────────────────────────────╮
12+
│ │
13+
│ Update available! More info at │
14+
│ https://ï.at/deployer-releases │
15+
│ │
16+
╰────────────────────────────────────────────╯
1517
1618
tasks:
1719
release:
20+
- update_banner
1821
- update_manifest
19-
20-
create_banner:
21-
- desc: Create an update banner
22-
- run: echo $'{{banner}}' > {{site}}/check-updates/{{old_version}}

src/Support/update_banner.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php declare(strict_types=1);
2+
3+
/* (c) Anton Medvedev <anton@medv.io>
4+
*
5+
* For the full copyright and license information, please view the LICENSE
6+
* file that was distributed with this source code.
7+
*/
8+
9+
namespace Deployer;
10+
11+
task('update_banner', function () {
12+
$skipCurrentVersion = get('version');
13+
$manifestPath = '~/deployer.org/artifacts/manifest.json';
14+
$manifest = json_decode(run("cat $manifestPath"), true);
15+
$commands = '';
16+
foreach ($manifest as $m) {
17+
if ($skipCurrentVersion === $m['version']) {
18+
continue;
19+
}
20+
$commands .= "echo -n '{{banner}}' > ~/deployer.org/check-updates/{$m['version']};\n";
21+
}
22+
run($commands);
23+
});

0 commit comments

Comments
 (0)