.gitlab-ci.yml 2.83 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:12.18.4
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

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:
36 37
    - yarn global add gulp-cli
    - yarn install
38
    - cd tools/vf-core
Ken Hawkins's avatar
Ken Hawkins committed
39
    - gulp vf-core:prepare-deploy
Ken Hawkins's avatar
Ken Hawkins committed
40 41
  artifacts:
    paths:
42
      - tools/vf-core/build
Ken Hawkins's avatar
Ken Hawkins committed
43 44 45
  cache:
    paths:
      - node_modules
Peter Walter's avatar
Peter Walter committed
46
  except:
Peter Walter's avatar
Peter Walter committed
47
    - /^.visual-framework\/.*$/
Ken Hawkins's avatar
Ken Hawkins committed
48 49 50 51 52 53 54 55 56 57

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:
58
    - for VM in ${VM_DEV}; do rsync -acv --delete-after tools/vf-core/build/. ${SSH_OWNER_ID}@${VM}:${VM_PATH}/; done;
Ken Hawkins's avatar
Ken Hawkins committed
59
  only:
60
    # only match on develop branch, or specific tag patterns
61
    - develop
62
    - /^v\d+\.\d+\.\d+$/
63
    - /^v\d+\.\d+\.\d+-(alpha|beta|rc)\.\d+$/
Ken Hawkins's avatar
Ken Hawkins committed
64 65 66 67 68 69 70 71 72 73

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:
74
    - for VM in ${VM_PROD}; do rsync -acv --delete-after tools/vf-core/build/. ${SSH_OWNER_ID}@${VM}:${VM_PATH}/; done;
Ken Hawkins's avatar
Ken Hawkins committed
75
  only:
76 77
    # only match on specific tag patterns
    - /^v\d+\.\d+\.\d+$/
78
    - /^v\d+\.\d+\.\d+-(alpha|beta|rc)\.\d+$/
Ken Hawkins's avatar
Ken Hawkins committed
79 80 81 82 83 84 85 86 87 88 89

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:
90
    # only match on develop branch, or specific tag patterns
91
    - develop
92
    - /^v\d+\.\d+\.\d+$/
93
    - /^v\d+\.\d+\.\d+-(alpha|beta|rc)\.\d+$/
Ken Hawkins's avatar
Ken Hawkins committed
94 95 96 97 98 99 100 101 102 103 104

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:
105 106
    # only match on specific tag patterns
    - /^v\d+\.\d+\.\d+$/
107
    - /^v\d+\.\d+\.\d+-(alpha|beta|rc)\.\d+$/