Commit 1b34d90f authored by Pietro Saccardi's avatar Pietro Saccardi
Browse files

Using yaml anchors to type script only once

parent 2b48cd11
Loading
Loading
Loading
Loading
Loading
+12 −17
Original line number Diff line number Diff line
@@ -16,12 +16,8 @@ build:lektor:
      - www


staging:testing:
  stage: staging
.deploy_template: &deploy_definition  # Hidden key that defines an anchor named 'job_definition'
  image: nikolaik/python-nodejs
  environment:
    name: staging
    url: https://www.test.mittelab.org
  before_script:
    - apt-get update -qq
    - apt-get install -qq -yy rsync
@@ -29,29 +25,28 @@ staging:testing:
    - chmod 700 ~/.ssh
    - echo "${DEPLOY_KNOWN_HOST}" > ~/.ssh/known_hosts
    - pipenv install
  script:
    - pipenv run lektor deploy -O www --key "${DEPLOY_KEY}" --username "${DEPLOY_USER}" testing
  only:
    - master


staging:testing:
  stage: staging
  <<: *deploy_definition
  environment:
    name: staging
    url: https://www.test.mittelab.org
  script:
    - pipenv run lektor deploy -O www --key "${DEPLOY_KEY}" --username "${DEPLOY_USER}" testing


deploy:production:
  stage: deploy
  image: nikolaik/python-nodejs
  <<: *deploy_definition
  environment:
    name: deploy
    url: https://www.mittelab.org
  before_script:
    - apt-get update -qq
    - apt-get install -qq -yy rsync
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "${DEPLOY_KNOWN_HOST}" > ~/.ssh/known_hosts
    - pipenv install
  script:
    - pipenv run lektor deploy -O www --key "${DEPLOY_KEY}" --username "${DEPLOY_USER}" production
  only:
    - master
  when: manual
  dependencies:
    - build:lektor