I used pelican as the static site generator to build a static site. I wanted to host it on GitLab Pages and let the site generate with GitLab's continuous integration with Makefile.
The site successfully builds locally as well as on GitLab via its CI/CD pipeline.
The build code passes with artifacts uploaded and job succeeded. The content files are built and produced in the public
folder.
Somehow, after the build being passed and artifacts being uploaded in public
folder as desired, it was expected to have the static site hosted on the user pages of GitLab Pages like username.gitlab.io/projectname
.
This did not work even after 15+ hours though the recommended wait time was fifteen minutes to half an hour.
Hosting on a custom subdomain was also tried. The subdomain is verified, yet the site is not being generated.
For reference, minimal code in use is mentioned below.
# default to using the latest Python docker image for builds
image: python:3.7.0
# our build job installs the Python requirements and Pelican
# plugins, then runs ``make publish`` to generate the output
build:
stage: deploy
script:
- apt-get update -qq && apt-get install -y -qq python python-pip
- python -v
- pip install -r requirements.txt
- git clone --recursive https://github.com/getpelican/pelican-plugins ../plugins
- pelican -s publishconf.py
- make publish
# specify the artifacts to save
artifacts:
paths:
- public/
only:
- master
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
AUTHOR = 'Tanya Jain'
SITENAME = 'Tanya Jain'
SITEURL = '/public'
DESCRIPTION = ''
THEME = 'themes/stellarAdventurerTheme'
PATH = 'content'
OUTPUT_PATH = 'public'
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
AUTHOR = 'Tanya Jain'
SITENAME = 'Tanya Jain'
SITEURL = '/public'
DESCRIPTION = ''
THEME = 'themes/stellarAdventurerTheme'
PATH = 'content'
OUTPUT_PATH = 'public'
PY?=python3
PELICAN?=pelican
PELICANOPTS=
BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
OUTPUTDIR=$(BASEDIR)/public
CONFFILE=$(BASEDIR)/pelicanconf.py
PUBLISHCONF=$(BASEDIR)/publishconf.py
FTP_HOST=localhost
FTP_USER=anonymous
FTP_TARGET_DIR=/
SSH_HOST=localhost
SSH_PORT=22
SSH_USER=root
SSH_TARGET_DIR=/var/www
Kindly help out on how to generate the site on GitLab Pages!
Tried these changes which too did not work. Yet, I believe the changes are to be made in the pelican settings and not the GitLab's YAML.
SITEURL = ''
SITEURL = 'http://subdomain.example.com'
Thanks a lot for helping out! I have solved the problem. The error was due to mentioning the job as build
in .gitlab-ci.yml and also, missing of the job pages
. Using pages
as a job is a necessity of the GitLab Pages to be deployed, which can further read in the references mentioned. Hence, the correct script would be:
image: python:3.7.0
pages:
stage: deploy
script:
- apt-get update -qq && apt-get install -y -qq python python-pip
- python -v
- pip install -r requirements.txt
- git clone --recursive https://github.com/getpelican/pelican-plugins ../plugins
- pelican -s publishconf.py
- make publish
artifacts:
paths:
- public/
only:
- master
References: