TODO: comments and stats didn’t work
For GitHub/GitLab Pages, you don’t have to use GitLab/GitHub to build your site. You can build your site on your laptop, then push the rendered website HTML. Why do this? Your laptop builds faster than the cloud, or maybe you figure since you’ve just built the website preview on your laptop, why not ensure others see exactly what you see. This also allows using non-Jekyll static renderers on GitHub, which allows only Jekyll builds. (GitLab allows any static site renderer).
Assuming you’ve already created a Jekyll website, here’s how to switch to rendering HTML on your website and disabling remote rendering. Note: deploying on GitLab still uses Runner minutes, but obviously many fewer minutes overall than remote building.
GitLab Runner is reconfigured simply deploy your laptop-rendered HTML by:
- backup old
mv .gitlab-ci.yml .gitlab-ci.yml.disabled
- create new
pages: script: - mkdir .public - cp -r * .public - mv .public public artifacts: paths: - public only: - master
If this is your first build, do the “first build only” first.
- update packages
- build HTML
jekyll build -d public
- push rendered HTML i.e.
First build only
- get prereqs
apt install ruby-dev libssl-dev gem update --system
- be sure Gems are installed to home directory, NOT system (no sudo) by adding to
# Install Ruby Gems to ~/gems export GEM_HOME=$HOME/gems export PATH=$HOME/gems/bin:$PATH
- Add HTML output directory to Git tracking
mkdir public git add public
Running out of GitLab Runner minutes
GitLab Runner minutes are limited to 2000 minutes for free users on private repos. Runner minutes are unlimited for public repos. Normally I recommend a private repo for GitHub/GitLab pages, but if it’s OK for your use, you could make the website project public. You could store the website Jekyll source in a private GitLab repo, and push the rendered HTML to a public GitLab repo.