Skip to content

Commit e972064

Browse files
authored
Update hugo (#12)
1 parent 2ed8099 commit e972064

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

.github/workflows/build_and_deploy.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup Hugo
1919
uses: peaceiris/actions-hugo@v2
2020
with:
21-
hugo-version: '0.144.2'
21+
hugo-version: '0.152.2'
2222

2323
- name: Setup PHP
2424
uses: shivammathur/setup-php@v2
@@ -30,6 +30,7 @@ jobs:
3030
run: ./book build-all
3131

3232
- name: Deploy
33+
if: success()
3334
uses: appleboy/scp-action@master
3435
with:
3536
host: terminal42.ch

book

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ if (!in_array($command, $commands, true)) {
1919
exit(1);
2020
}
2121

22-
$runCommand = function (string $command) {
22+
$runCommand = function (string $command): int {
2323
echo $command . "\n";
24-
echo system($command);
24+
echo system($command, $resultCode);
25+
return $resultCode;
2526
};
2627

27-
$buildBook = function(string $book) use ($runCommand) {
28+
$buildBook = function(string $book) use ($runCommand): int {
2829
$command = <<<COMMAND
2930
cd page; hugo \
3031
--cleanDestinationDir \
@@ -34,11 +35,11 @@ cd page; hugo \
3435
--baseURL https://extensions.terminal42.ch/docs/{book}/
3536
COMMAND;
3637

37-
$runCommand(str_replace('{book}', $book, $command));
38+
return $runCommand(str_replace('{book}', $book, $command));
3839
};
3940

4041

41-
$liveBook = function(string $book) use ($runCommand) {
42+
$liveBook = function(string $book) use ($runCommand): int {
4243
$command = <<<COMMAND
4344
cd page; hugo server \
4445
--cleanDestinationDir \
@@ -47,24 +48,25 @@ cd page; hugo server \
4748
--logLevel info
4849
COMMAND;
4950

50-
$runCommand(str_replace('{book}', $book, $command));
51+
return $runCommand(str_replace('{book}', $book, $command));
5152
};
5253

5354
preg_match('/^(build|live)-(.*)/', $command, $matches);
5455

5556
if ('build-all' === $matches[0]) {
5657
foreach ($books as $book) {
57-
$buildBook($book);
58+
$result = $buildBook($book);
59+
if (0 !== $result) {
60+
exit($result);
61+
}
5862
}
59-
return;
63+
exit(0);
6064
}
6165

6266
if ('build' === $matches[1]) {
63-
$buildBook($matches[2]);
64-
return;
67+
exit($buildBook($matches[2]));
6568
}
6669

6770
if ('live' === $matches[1]) {
68-
$liveBook($matches[2]);
69-
return;
71+
exit($liveBook($matches[2]));
7072
}

page/themes/hugo-theme-relearn

Submodule hugo-theme-relearn updated 783 files

0 commit comments

Comments
 (0)