Created
February 11, 2020 12:31
-
-
Save kant312/da097ad3f91ecc110792df54a95ed82f to your computer and use it in GitHub Desktop.
My ready to go GitLab config to deploy an Eleventy website on a VPS using rsync and ssh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages: | |
- build | |
- deploy | |
eleventy: | |
stage: build | |
image: node:lts-buster | |
cache: | |
key: "$CI_JOB_NAME" | |
paths: | |
- node_modules/ | |
script: | |
- npm install | |
- npm run build | |
artifacts: | |
paths: | |
- dist/ | |
only: | |
- master | |
rsync: | |
stage: deploy | |
image: instrumentisto/rsync-ssh | |
script: | |
- mkdir "${HOME}/.ssh" | |
- echo "${SSH_HOST_KEY}" > "${HOME}/.ssh/known_hosts" | |
- echo "${SSH_PRIVATE_KEY}" > "${HOME}/.ssh/id_rsa" | |
- chmod 700 "${HOME}/.ssh/id_rsa" | |
- rsync -avH dist/* -e ssh ${SSH_USER}@${SSH_HOST}:${WEBROOT_PATH} | |
only: | |
- master |
Thank you! ๐
Even 4 years later this is helpful! :) Thanks!
Even 4 years later this is helpful! :) Thanks!
Thank you! Glad to know it ๐
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@zomars "HOME" is a system variable that points to the current user's home directory. The other variables can be defined in Gitlab CI/CD Settings, under the variables section. More info here: https://gitlab.com/help/ci/variables/README#variables