Deploy zola website with gitlab pages
A quick note on how to deploy a zola
website with gitlab
pages
.
You need a working git
repository on a gitlab
instance. Here we also use git-lfs
, if you want you can ignore lines containing lfs
.
You also need your repository to contain a zola
website that builds on your computer.
Then, you can setup the .gitlab-ci.yml
.
Create a .gitlab-ci.yml
file at the root of your git repository, containing:
image: alpine:edge
test-website:
except:
- master
script:
- apk add git git-lfs zola
- git config --global --add safe.directory ${PWD}
- git lfs pull
- git submodule update --init --recursive
- mkdir templates
- mkdir public
- zola build
pages:
only:
- master
script:
- apk add git git-lfs zola rsync openssh
- git config --global --add safe.directory ${PWD}
- git lfs pull
- git submodule update --init --recursive
- mkdir templates
- mkdir public
- zola build
artifacts:
paths:
- public
You need to add this file git add .gitlab-ci.yml
and push
it.
It will build your website in the CI/CD
.
Go to your project settings: Settings > General > Visibility and select Everyone in pages section.
You can go to Settings > Pages > New Domain, if you want to specify a domain. In this case it will generate new DNS records that you need to send to the admin of your domain.