Commit 702b7859 authored by Matthieu Boileau's avatar Matthieu Boileau

Update gitlab-ci pipeline

- pass artifact from build to deploy
- update publishconf to use branch name (CI_COMMIT_REF_NAME)
parent 1cd27260
Pipeline #3677 passed with stages
in 4 minutes and 12 seconds
......@@ -38,7 +38,8 @@ build:
- echo "Building website using docker image $CI_REGISTRY_IMAGE"
script:
- pelican -s publishconf.py --fatal errors
artifacts:
untracked: true
apache-dev:
stage: deploy
......@@ -55,9 +56,9 @@ apache-dev:
- develop
- /^dev-.*$/
- embed_twitter_v2
dependencies:
- build
script:
- sed "s/^[[:space:]]*SITEURL[[:space:]]*=.*/SITEURL = 'https:\/\/calcul-dev.math.unistra.fr\/$CI_COMMIT_REF_NAME'/" publishconf.py > publishconf-dev.py
- pelican -s publishconf-dev.py --fatal errors
- rsync -av --delete --exclude 'attachments' output/ $PUBLISH_DIR/
- rsync -av --delete content/attachments/ $PUBLISH_DIR/attachments/
......@@ -70,17 +71,20 @@ apache:
PUBLISH_DIR: "gitlab-runner@calcul.math.unistra.fr:/var/www/html"
only:
- master
dependencies:
- build
script:
- pelican -s publishconf.py --fatal errors
- rsync -av --delete --exclude 'attachments' output/ $PUBLISH_DIR/
- rsync -av --delete content/attachments/ $PUBLISH_DIR/attachments/
update-issue:
stage: deploy
image: $CI_REGISTRY_IMAGE
tags:
- pelican
- docker
only:
- develop
dependencies: []
before_script:
- echo "Updating issue \#49"
script:
......
......@@ -10,7 +10,15 @@ import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = '{{siteurl}}'
# Get git_branch from gitlab-ci environment variable or fallback to master
git_branch = os.environ.get('CI_COMMIT_REF_NAME', 'master')
if git_branch == 'master':
SITEURL = 'https://calcul.math.unistra.fr'
else:
SITEURL = 'https://calcul-dev.math.unistra.fr/{}'.format(git_branch)
RELATIVE_URLS = False
FEED_ALL_ATOM = 'feeds/all.atom.xml'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment