Commit 5ae1296a authored by Luke Marlin's avatar Luke Marlin Committed by Luke Marlin
Browse files

Add CI

The CI builds, tags, create a release and a generic pages and finally
publishes to Gitlab pages automatically.
For development branches, it will only build.
parent a2c79c49
stages:
- build
- package
- release
- deploy
build-job:
image: python:slim
stage: build
rules:
- if: '$CI_COMMIT_BRANCH'
script:
- mkdir -p /usr/share/man/man1 # Because of https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199
- apt-get update && apt-get install -y plantuml graphviz
- pip install -r requirements.txt
- pelican content -s publishconf.py -e OUTPUT_PATH=public/
artifacts:
paths:
- public/
name: build
expire_in: 7 days
package-job:
stage: package
tags: [redshift] # Used to prevent runner 1000i100 from picking up this stage
image: curlimages/curl:latest
script:
- PACKAGE_VERSION="$(date +%Y.%m).${CI_PIPELINE_IID}"
- PACKAGE_REGISTRY_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/releases/${PACKAGE_VERSION}"
- echo 'Creating generic package'
- cd public/
- tar cvf $HOME/website.tar *
- ls -al
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file $HOME/website.tar ${PACKAGE_REGISTRY_URL}/website.tar'
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
release-job:
stage: release
tags: [redshift] # Used to prevent runner 1000i100 from picking up this stage
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
script:
- PACKAGE_VERSION="$(date +%Y.%m).${CI_PIPELINE_IID}"
- PACKAGE_REGISTRY_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/releases/${PACKAGE_VERSION}"
- echo 'Creating release'
- release-cli create --name "$PACKAGE_VERSION" --tag-name $PACKAGE_VERSION --assets-link "{\"name\":\"wesbite.tar\",\"url\":\"$PACKAGE_REGISTRY_URL/website.tar\"}"
pages:
stage: deploy
tags: [redshift]
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
script:
- echo "Publishing to Gitlab pages"
artifacts:
paths:
- public/
\ No newline at end of file
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
import sys
sys.path.append('.')
from pelicanconf import *
SITEURL = u'https://duniter.org/en'
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