Skip to content

Commit 5195139

Browse files
committed
footer includes commit hash
1 parent 53194b9 commit 5195139

File tree

7 files changed

+54
-17
lines changed

7 files changed

+54
-17
lines changed

antora-ui/build.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ if [ -z "$npm_version" ]; then
77
echo "npm is not installed"
88
exit 1
99
fi
10+
1011
gulp_version=$(gulp --version 2>/dev/null)
1112
if [ -z "$gulp_version" ]; then
1213
echo "gulp is not installed"
1314
exit 1
1415
fi
1516

16-
npm install
17+
if [ ! -d "node_modules" ] || [ "$(find package.json -prune -printf '%T@\n' | cut -d . -f 1)" -gt "$(find node_modules -prune -printf '%T@\n' | cut -d . -f 1)" ]; then
18+
npm install
19+
fi
20+
1721
gulp bundle
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<footer class="footer">
22
<p>This page was built using the Antora default UI.</p>
33
<p>The source code for this UI is licensed under the terms of the MPL-2.0 license.</p>
4+
<p><a href="https://github.com/cppalliance/site-docs">https://github.com/cppalliance/site-docs</a></p>
5+
{{#if page.attributes.boost-branch}}
6+
<p>boost-branch: {{ page.attributes.boost-branch }}</p>
7+
{{/if}}
8+
{{#if page.attributes.commit-id}}
9+
<p>commit-id: {{ page.attributes.commit-id }}</p>
10+
{{/if}}
411
</footer>

build.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
#!/bin/sh
22

3-
./sitedoc.sh develop
3+
if command -v git >/dev/null && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
4+
branch=$(git rev-parse --abbrev-ref HEAD)
5+
else
6+
branch="develop"
7+
fi
8+
9+
if [ "$branch" != "master" ] && [ "$branch" != "develop" ]; then
10+
branch="develop"
11+
fi
12+
13+
./sitedoc.sh "$branch"

libdoc.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,27 @@ if ! [ -e "$script_dir/antora-ui/build/ui-bundle.zip" ]; then
5555
cd "$cwd" || exit
5656
fi
5757

58+
if command -v git >/dev/null && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
59+
commit_id=$(git rev-parse HEAD)
60+
commit_id=$(expr substr "$commit_id" $(expr length "$commit_id" - 7) 8)
61+
else
62+
commit_id=""
63+
fi
64+
5865
# Run antora command
5966
while test $# -gt 0; do
6067
if [ "$1" = "develop" ] || [ "$1" = "master" ]; then
6168
$ANTORA_CMD --fetch \
6269
--attribute page-boost-branch=$1 \
6370
--attribute page-boost-ui-branch=$1 \
71+
--attribute page-commit-id="$commit_id" \
6472
libs.playbook.yml
6573

6674
elif [ "$1" = "release" ]; then
6775
$ANTORA_CMD --fetch \
6876
--attribute page-boost-branch=master \
6977
--attribute page-boost-ui-branch=master \
78+
--attribute page-commit-id="$commit_id" \
7079
--attribute page-boost-is-release=true \
7180
libs.playbook.yml
7281

@@ -77,6 +86,7 @@ while test $# -gt 0; do
7786
$ANTORA_CMD --fetch \
7887
--attribute page-boost-branch=$1 \
7988
--attribute page-boost-ui-branch=master \
89+
--attribute page-commit-id="$commit_id" \
8090
"$f"
8191
else
8292
echo "Playbook \"$f\" does not exist"

libs.playbook.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ asciidoc:
3030
page-boost-branch: develop
3131
page-boost-ui-branch: develop
3232
page-boost-is-release: ''
33+
page-commit-id: ''
3334

3435
site:
3536
url: https://antora.cppalliance.org/${page-boost-branch}/lib/doc

site.playbook.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
asciidoc:
2121
attributes:
2222
page-boost-branch: develop
23+
page-commit-id: ''
2324

2425
site:
2526
url: https://antora.cppalliance.org

sitedoc.sh

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,27 @@ fi
4242

4343
cwd=$(pwd)
4444
script_dir=$(dirname "$(readlink -f "$0")")
45-
if ! [ -e "$script_dir/antora-ui/build/ui-bundle.zip" ]; then
45+
if ! [ -e "$script_dir/antora-ui/build/ui-bundle.zip" ] || \
46+
find "$script_dir/antora-ui" -newer "$script_dir/antora-ui/build/ui-bundle.zip" -print -quit | grep -q .
47+
then
4648
cd "$script_dir/antora-ui" || exit
4749
./build.sh
4850
cd "$cwd" || exit
4951
fi
5052

51-
while test $# -gt 0; do
52-
if [ "$1" = "develop" ]; then
53-
$ANTORA_CMD --fetch \
54-
--attribute page-boost-branch=$1 \
55-
site.playbook.yml
56-
elif [ "$1" = "master" ]; then
57-
$ANTORA_CMD --fetch \
58-
--attribute page-boost-branch=$1 \
59-
site.playbook.yml
60-
else
61-
echo "invalid argument: '$1'"
62-
fi
63-
shift
64-
done
53+
if command -v git >/dev/null && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
54+
commit_id=$(git rev-parse HEAD)
55+
commit_id=$(expr substr "$commit_id" $(expr length "$commit_id" - 7) 8)
56+
else
57+
commit_id=""
58+
fi
59+
60+
if [ "$1" != "develop" ] && [ "$1" != "master" ]; then
61+
echo "invalid argument: '$1'"
62+
exit 1
63+
fi
64+
65+
$ANTORA_CMD --fetch \
66+
--attribute page-boost-branch="$1" \
67+
--attribute page-commit-id="$commit_id" \
68+
site.playbook.yml

0 commit comments

Comments
 (0)