www/.gitlab-ci.yml

89 lines
1.9 KiB
YAML

stages:
- pages
- calendar
- deploy
cache:
paths:
- ~/.cache/pip/
- public/
variables:
GIT_SUBMODULE_STRATEGY: recursive
build_pages:
image: "golang:1.10-alpine3.8"
stage: pages
variables:
SHELL: "/bin/sh"
artifacts:
untracked: true
script:
- apk add --no-cache --upgrade hugo
- hugo
build_calendar:
image: "python:3.7-alpine3.8"
stage: calendar
dependencies:
- build_pages
artifacts:
untracked: true
variables:
SHELL: "/bin/sh"
script:
- apk --no-cache update
- pip install -r requirements.txt
- python tools/merge_cals.py
- cp static/all.ics public/all.ics
- upcoming="$(python tools/gen_upcoming.py static/all.ics 14 5|tr '\n' ' ')" && sed -i "s#CALENDAR#$upcoming#g" public/index.html
deploy_staging:
image: "alpine:3.8"
stage: deploy
dependencies:
- build_calendar
variables:
SHELL: "/bin/sh"
script:
- apk --no-cache --upgrade add openssh-client rsync
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- echo "$PRIVATE_KEY" | ssh-add -
- rsync -e "ssh -l deploy -p 31337" -av public/ 195.54.164.87:staging/s
when: on_success
environment:
name: staging
url: https://staging.berlin.ccc.de/
artifacts:
paths:
- public/
only:
- staging
deploy_production:
image: "alpine:3.8"
stage: deploy
dependencies:
- build_calendar
variables:
SHELL: "/bin/sh"
script:
- apk --no-cache --upgrade add openssh-client rsync
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- echo "$PRIVATE_KEY" | ssh-add -
- rsync -e "ssh -l deploy -p 31337" -av public/ 195.54.164.87:production/s
when: on_success
environment:
name: staging
url: https://berlin.ccc.de/
artifacts:
paths:
- public/
only:
- staging