stages: - build - deploy build site: image: node:lts stage: build script: - yarn install --cache-folder .yarn - yarn build - rm dist/.gitkeep # Necessary because `/public` is empty at the moment cache: key: ${CI_COMMIT_REF_SLUG} paths: - .yarn artifacts: paths: - dist deploy dev: image: instrumentisto/rsync-ssh stage: deploy only: refs: - develop script: - mkdir ~/.ssh - echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - eval $(ssh-agent -s) - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - rsync -vr -e "ssh -p ${SSH_PORT}" dist/ "${DEPLOY_DEST}/dev/" deploy site: image: instrumentisto/rsync-ssh stage: deploy only: refs: - master script: - mkdir ~/.ssh - echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - eval $(ssh-agent -s) - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - rsync -vr -e "ssh -p ${SSH_PORT}" dist/ "${DEPLOY_DEST}"