Commit a525af95 authored by Matthieu Boileau's avatar Matthieu Boileau
Browse files

gitlab-ci: Add stages for master and develop

parent 167f436a
......@@ -3,14 +3,28 @@ stages:
- build
- deploy
# Only for publishing stages, must be overridden in other stages
before_script:
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add ssh private key
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
# Create the SSH directory and give it the right permissions
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
# Ensure host is verified
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
deps:
stage: deps
tags:
- pelican
script:
before_script:
- echo "Building $CI_REGISTRY_IMAGE"
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker info
- echo "Building $CI_REGISTRY_IMAGE"
script:
- docker build --pull -t $CI_REGISTRY_IMAGE -f ./docker/Dockerfile .
- docker push $CI_REGISTRY_IMAGE
......@@ -19,9 +33,12 @@ build:
image: $CI_REGISTRY_IMAGE
tags:
- docker
before_script:
- echo "Building website using docker image $CI_REGISTRY_IMAGE"
script:
- pelican -s publishconf.py --fatal errors
apache-dev:
stage: deploy
image: $CI_REGISTRY_IMAGE
......@@ -32,28 +49,40 @@ apache-dev:
only:
- pr_branch_deploy
- TEST-job-form
- WIP-indico
- theme
- docker
- develop
- /^dev-.*$/
- embed_twitter_v2
before_script:
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add ssh private key
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
# Create the SSH directory and give it the right permissions
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
# Ensure host is verified
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- echo "Publishing to $PUBLISH_DIR"
- 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/
apache:
stage: deploy
image: $CI_REGISTRY_IMAGE
tags:
- docker
variables:
PUBLISH_DIR: "gitlab-runner@calcul.math.unistra.fr:/var/www/html"
only:
- master
script:
- echo "Publishing to $PUBLISH_DIR"
- 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
tags:
- pelican
only:
- develop
before_script:
- echo "Updating issue \#49"
script:
- python3 utils/follow_transfer.py --issue
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