Gitlab CI/CD deployed this change!

This post is part of a change deployed via CI/CD on my Gitlab server. It worked! Here’s my gitlab-ci.yml:


stages:
  - build
  - deploy

variables:
  BUILD_DIR: 'tmp/build'

build_prod:
  stage: build
  image: jasonsdocker2018/hugoserver:latest
  only:
    - master
  artifacts:
    paths:
      - 'tmp/build/'
  script:
    - mkdir -p tmp/build
    - hugo --destination 'tmp/build' -v
    - ls -lash tmp/build

deploy_prod:
  stage: deploy
  dependencies:
  - build_prod
  image: jasonsdocker2018/hugoserver:latest
  only:
    - master
  artifacts:
    paths:
      - 'tmp/build/'
  script:
    - mkdir -p "/tmp/build"
    - BUILD_DIR="/tmp/build"
    - mkdir /root/.ssh
    - echo "${SSH_PRIVATE_KEY}" > "/root/.ssh/id_rsa"
    - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > "${HOME}/.ssh/config"
    - chmod 700 "/root/.ssh/id_rsa"
    - echo "${KNOWN_HOSTS}" > "/root/.ssh/known_hosts"
    - hugo --destination "$BUILD_DIR" --cleanDestinationDir -v
    - rsync -rvz --delete --exclude=_ -e 'ssh -i "/root/.ssh/id_rsa"' "$BUILD_DIR"/ jason@jasondale.me:/home/jason/www-data/homepage

variables:
  CI_REPOSITORY_URL: https://gitlab.jasondale.me