image: ebiwd/alpine-ssh:3.6 #project specific variables can be defined here, or overridden project settings variables: # do not define here, put in project variables SSH_OWNER_ID: wd_drupl SSH_APACHE_ID: w3_wd01 # set secrets in Settings -> Pipelines -> Secret Variables SSH_WD_DRUPL: secret-key SSH_W3_WD01: secret-key stages: - build - test - deploy - validate build: stage: build image: ebiwd/node-bower-gulp:10 tags: - docker script: - npm install - gulp cache: paths: - node_modules artifacts: paths: - dist test: stage: test tags: - docker script: # test .htaccess has been generated - if [ ! -f ${CI_PROJECT_DIR}/dist/.htaccess ]; then echo "Missing .htaccess"; exit 1; fi # test index.html has been generated - if [ ! -f ${CI_PROJECT_DIR}/dist/index.html ]; then echo "Missing index.html"; exit 1; fi # setup ssh keys .deploy_template: &deploy stage: deploy tags: - docker before_script: - add-ssh-key ${SSH_OWNER_ID} "${SSH_WD_DRUPL}" ${SSH_APACHE_ID} "${SSH_W3_WD01}" - add-search-domain ebi.ac.uk - cd ${CI_PROJECT_DIR}; dependencies: - build script: - bin/deploy ${ENVIRONMENT} deploy-dev: stage: deploy only: - master variables: ENVIRONMENT: dev <<: *deploy deploy-stage: stage: deploy only: - master variables: ENVIRONMENT: stage <<: *deploy deploy-prod: stage: deploy only: - tags variables: ENVIRONMENT: prod <<: *deploy validate_dev: stage: validate script: - set -a; source ${CI_PROJECT_DIR}/.env; set +a; - curl -L ${DEV_SITE_URL} | cmp ${CI_PROJECT_DIR}/dist/index.html - only: - master validate_prod: stage: validate script: - set -a; source ${CI_PROJECT_DIR}/.env; set +a; - curl -L ${PROD_SITE_URL} | cmp ${CI_PROJECT_DIR}/dist/index.html - only: - tags