From de6b3d0294434b53b3411429149a97926c71dfc8 Mon Sep 17 00:00:00 2001 From: Jordan Holt Date: Mon, 21 Mar 2022 12:48:08 +0000 Subject: [PATCH] Add CD definition --- .gitlab-ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..9ae3e04 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,21 @@ +deploy_production: + stage: deploy + before_script: + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - mkdir -p ~/.ssh + - echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/gitlab + - chmod 700 ~/.ssh/gitlab + - eval "$(ssh-agent -s)" + - ssh-add ~/.ssh/gitlab + - ssh-keyscan -H 'git.vimium.com' >> ~/.ssh/known_hosts + - apt-get install rsync -y -qq + - apt-get install curl -y -qq + script: + - echo "Deploying to pki.vimium.com" + - ssh -i ~/.ssh/gitlab -o StrictHostKeyChecking=no pki@vimium.com -p PORT + - rsync -avz --progress -a -e "ssh -p PORT" *.cer pki@vimium.com: + - echo "Deployed" + environment: + name: production + only: + - master