.gitlab-ci.yml 2.76 KB
Newer Older
1 2
# This script runs on gitlab.ebi.ac.uk
# https://gitlab.ebi.ac.uk/emblorg/vf-core-mirror
Ken Hawkins's avatar
Ken Hawkins committed
3
# We do it to deploy the pattern library for view
4
# http://www.embl.org/guidelines/visual-framework/dev-docs/
5
# https://dev.assets.emblstatic.net/vf/develop/
6
# https://dev.assets.emblstatic.net/vf/{tag}/ (eg v2.1.2 / v2.1.3-alpha.3)
7 8
# https://dev.assets.emblstatic.net/vf/{minor}/ (eg v2.1)
# https://dev.assets.emblstatic.net/vf/{major}/ (eg v2)
9
image: node:10.22.0
Ken Hawkins's avatar
Ken Hawkins committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

variables:
  # project specific variables can be defined here
  VM_DEV: wp-np2-10
  VM_PROD: wp-p1m-12 wp-p1m-13 wp-p2m-12 wp-p2m-13
  VM_PATH: /var/www/drupal/beta.embl.org.guidelines.visual-framework.dev-docs
  SSH_OWNER_ID: wd_drupl
  SSH_APACHE_ID: w3_wd01
  S3_BUCKET_DEV: origin.dev.vf.assets.emblstatic.net
  S3_BUCKET_PROD: origin.vf.assets.emblstatic.net
  # set secrets in Settings -> Pipelines -> Secret Variables
  SSH_OWNER_KEY: secret-key
  SSH_APACHE_KEY: secret-key
  AWS_KEY: key
  AWS_SECRET: secret-key


stages:
  - build
  - deploy

build:
  stage: build
  tags:
    - docker
  script:
    - npm install
    - npm install -g gulp-cli
Ken Hawkins's avatar
Ken Hawkins committed
38
    - gulp vf-core:prepare-deploy
Ken Hawkins's avatar
Ken Hawkins committed
39 40 41 42 43 44
  artifacts:
    paths:
      - build
  cache:
    paths:
      - node_modules
Peter Walter's avatar
Peter Walter committed
45
  except:
Peter Walter's avatar
Peter Walter committed
46
    - /^.visual-framework\/.*$/
Ken Hawkins's avatar
Ken Hawkins committed
47 48 49 50 51 52 53 54 55 56 57 58

deploy-dev:
  stage: deploy
  image: ebiwd/alpine-ssh
  tags:
    - docker
  before_script:
    - add-ssh-key ${SSH_OWNER_ID} "${SSH_OWNER_KEY}" ${SSH_APACHE_ID} "${SSH_APACHE_KEY}"
    - add-search-domain ebi.ac.uk
  script:
    - for VM in ${VM_DEV}; do rsync -acv --delete-after build/. ${SSH_OWNER_ID}@${VM}:${VM_PATH}/; done;
  only:
59
    # only match on develop branch, or specific tag patterns
60
    - develop
61
    - /^v\d+\.\d+\.\d+$/
62
    - /^v\d+\.\d+\.\d+-(alpha|beta|rc)\.\d+$/
Ken Hawkins's avatar
Ken Hawkins committed
63 64 65 66 67 68 69 70 71 72 73 74

deploy-prod:
  stage: deploy
  image: ebiwd/alpine-ssh
  tags:
    - docker
  before_script:
    - add-ssh-key ${SSH_OWNER_ID} "${SSH_OWNER_KEY}" ${SSH_APACHE_ID} "${SSH_APACHE_KEY}"
    - add-search-domain ebi.ac.uk
  script:
    - for VM in ${VM_PROD}; do rsync -acv --delete-after build/. ${SSH_OWNER_ID}@${VM}:${VM_PATH}/; done;
  only:
75 76
    # only match on specific tag patterns
    - /^v\d+\.\d+\.\d+$/
77
    - /^v\d+\.\d+\.\d+-(alpha|beta|rc)\.\d+$/
Ken Hawkins's avatar
Ken Hawkins committed
78 79 80 81 82 83 84 85 86 87 88

deploy-aws-dev:
  stage: deploy
  image: ebiwd/alpine-ssh
  tags:
    - docker
  before_script:
    - add-aws-key ${AWS_KEY} ${AWS_SECRET}
  script:
    - bin/deploy-aws
  only:
89
    # only match on develop branch, or specific tag patterns
90
    - develop
91
    - /^v\d+\.\d+\.\d+$/
92
    - /^v\d+\.\d+\.\d+-(alpha|beta|rc)\.\d+$/
Ken Hawkins's avatar
Ken Hawkins committed
93 94 95 96 97 98 99 100 101 102 103

deploy-aws-prod:
  stage: deploy
  image: ebiwd/alpine-ssh
  tags:
    - docker
  before_script:
    - add-aws-key ${AWS_KEY} ${AWS_SECRET}
  script:
    - bin/deploy-aws prod
  only:
104 105
    # only match on specific tag patterns
    - /^v\d+\.\d+\.\d+$/
106
    - /^v\d+\.\d+\.\d+-(alpha|beta|rc)\.\d+$/