cotech-website/.gitlab-ci.yml

68 lines
1.2 KiB
YAML
Raw Normal View History

image: ruby:2.5.8
stages:
- test
- staging
- production
variables:
JEKYLL_ENV: production
LC_ALL: C.UTF-8
2018-11-29 17:35:40 +00:00
cache:
key: gems
paths:
2018-11-30 17:25:23 +00:00
- vendor
2018-11-29 17:35:40 +00:00
before_script:
2018-11-18 16:05:08 +00:00
- 'which rsync || ( apt-get update -qq && apt-get install rsync -yqq )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
2018-11-30 17:25:23 +00:00
- bundle install --path vendor
test:
stage: test
script:
- bundle exec jekyll build -d test
artifacts:
paths:
- test
except:
- master
2018-11-30 16:12:38 +00:00
deploy:dev:
stage: staging
script:
- bundle exec jekyll build -d public
2018-11-30 18:01:32 +00:00
- rsync -aqz --delete-after public/ cotech@webarch2.co.uk:sites/dev/
artifacts:
paths:
- public
environment:
2018-11-30 16:12:38 +00:00
name: dev
2018-11-30 18:01:32 +00:00
url: https://dev.coops.tech
only:
- master
2018-11-30 16:12:38 +00:00
deploy:production:
stage: production
script:
2018-11-29 14:47:18 +00:00
- bundle exec jekyll build -d public
2018-11-30 18:01:32 +00:00
- rsync -aqz --delete-after public/ cotech@webarch2.co.uk:sites/default/
artifacts:
paths:
- public
environment:
2018-11-30 16:12:38 +00:00
name: production
2018-11-30 18:01:32 +00:00
url: https://www.coops.tech
only:
2018-11-30 16:12:38 +00:00
- master
when: manual
after_script:
- rm -rf /root/.ssh/