Skip to content

Commit df50e88

Browse files
walpoxljsong
authored andcommitted
Update GitLab Pages deployment documentation (#2844)
* docs: update gitlab pages doc * docs: add clarification about variable * docs: indent lines in document * feat(docs): add fuzzy version matching to template * docs: fix minor typo * revert(docs): change image back to debian * docs(ci): update gitlab-pages.md
1 parent 2e9621b commit df50e88

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

docs/content/documentation/deployment/gitlab-pages.md

+12-20
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ We provide you with a template to accomplish this task easily.
4444
Create a file called `.gitlab-ci.yml` in the root directory of your
4545
repository and copy the contents of the template below.
4646

47+
Make sure you specify a version of Zola in the `ZOLA_VERSION` variable.
48+
4749
```yaml
4850
stages:
4951
- deploy
@@ -56,9 +58,9 @@ variables:
5658
# set to "recursive".
5759
GIT_SUBMODULE_STRATEGY: "recursive"
5860

59-
# If you don't set a version here, your site will be built with the latest
60-
# version of Zola available in GitHub releases.
61-
# Use the semver (x.y.z) format to specify a version. For example: "0.17.2" or "0.18.0".
61+
# Make sure you specify a version of Zola here.
62+
# Use the semver format (x.y.z) to specify a version.
63+
# For example: "0.17.2" or "0.18.0".
6264
ZOLA_VERSION:
6365
description: "The version of Zola used to build the site."
6466
value: ""
@@ -67,30 +69,20 @@ pages:
6769
stage: deploy
6870
script:
6971
- |
70-
apt-get update --assume-yes && apt-get install --assume-yes --no-install-recommends wget ca-certificates
71-
if [ $ZOLA_VERSION ]; then
72-
zola_url="https://github.com/getzola/zola/releases/download/v$ZOLA_VERSION/zola-v$ZOLA_VERSION-x86_64-unknown-linux-gnu.tar.gz"
73-
if ! wget --quiet --spider $zola_url; then
74-
echo "A Zola release with the specified version could not be found.";
75-
exit 1;
76-
fi
77-
else
78-
github_api_url="https://api.github.com/repos/getzola/zola/releases/latest"
79-
zola_url=$(
80-
wget --output-document - $github_api_url |
81-
grep "browser_download_url.*x86_64.*linux-gnu.tar.gz" |
82-
cut --delimiter : --fields 2,3 |
83-
tr --delete "\" "
84-
)
72+
apt-get update
73+
DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --no-install-recommends wget ca-certificates
74+
zola_url="https://github.com/getzola/zola/releases/download/v${ZOLA_VERSION}/zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
75+
if ! wget --quiet --spider $zola_url; then
76+
echo "A Zola release with the specified version could not be found."
77+
exit 1
8578
fi
8679
wget $zola_url
8780
tar -xzf *.tar.gz
8881
./zola build --base-url $CI_PAGES_URL
8982
9083
artifacts:
9184
paths:
92-
# This is the directory whose contents will be deployed to the GitLab Pages
93-
# server.
85+
# This is the directory whose contents will be deployed to the GitLab Pages server.
9486
# GitLab Pages expects a directory with this name by default.
9587
- public
9688

0 commit comments

Comments
 (0)