97667077e1
@chris has setup a server[1] and added the public half of a key pair generated using `ssh-keygen -o -t rsa -b 4096` as per the instructions on docs.gitlab.com[2]. The `before_script` was taken from the same instructions. I set the two variables SSH_PRIVATE_KEY and SSH_KNOWN_HOSTS in the CI/CD settings[3]. To see if this works I'm calling `rsync` in the `script` section of the deploy stage, using the dry-run option, `-n`. [1] https://git.coop/cotech/website/issues/4#note_9890 [2] https://docs.gitlab.com/ee/ci/ssh_keys/#ssh-keys-when-using-the-docker-executor [3] https://git.coop/cotech/website/settings/ci_cd
37 lines
720 B
YAML
37 lines
720 B
YAML
image: ruby:2.5.3
|
|
|
|
variables:
|
|
JEKYLL_ENV: production
|
|
LC_ALL: C.UTF-8
|
|
|
|
before_script:
|
|
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
|
- 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
|
|
- bundle install
|
|
|
|
test:
|
|
stage: test
|
|
script:
|
|
- bundle exec jekyll build -d test
|
|
artifacts:
|
|
paths:
|
|
- test
|
|
except:
|
|
- master
|
|
|
|
pages:
|
|
stage: deploy
|
|
script:
|
|
- bundle exec jekyll build -d public
|
|
- rsync -anv public/ cotech@webarch2.co.uk:~/sites/default/
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
only:
|
|
- master
|