.gitlab-ci.yml 2.1 KB
Newer Older
John Long's avatar
John Long committed
1
php:7.1:
2
  image: adduc/ubuntu-php:7.1-build
3 4 5
  cache:
    paths:
    - dependencies/vendor
John Long's avatar
John Long committed
6
    - dependencies/node_modules
7
  script:
8 9 10 11 12 13 14 15
  - composer ci -d dependencies
  # Needed because artifacts can't be excluded
  - rsync -rtl ./ artifacts/ --exclude=.git --exclude=tests --exclude=node_modules --exclude=cache --exclude=.hg
  - composer install -d artifacts/dependencies --no-dev --classmap-authoritative
  artifacts:
    paths:
    - artifacts

16
php:7.2:
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
  image: adduc/ubuntu-php:7.2-build
  cache:
    paths:
    - dependencies/vendor
    - dependencies/node_modules
  script:
  - composer ci -d dependencies
  # Needed because artifacts can't be excluded
  - rsync -rtl ./ artifacts/ --exclude=.git --exclude=tests --exclude=node_modules --exclude=cache --exclude=.hg
  - composer install -d artifacts/dependencies --no-dev --classmap-authoritative
  artifacts:
    paths:
    - artifacts

php:7.3:
  image: adduc/ubuntu-php:7.3-build
33 34 35 36 37 38
  cache:
    paths:
    - dependencies/vendor
    - dependencies/node_modules
  script:
  - composer ci -d dependencies
39
  # Needed because artifacts can't be excluded
40
  - rsync -rtl ./ artifacts/ --exclude=.git --exclude=tests --exclude=node_modules --exclude=cache --exclude=.hg
41
  - composer install -d artifacts/dependencies --no-dev --classmap-authoritative
42 43
  artifacts:
    paths:
44
    - artifacts
45

John Long's avatar
John Long committed
46
deploy:prod:
47
  image: adduc/ubuntu-php:7.3-build
48 49
  stage: deploy
  script:
John Long's avatar
John Long committed
50
  - eval $(ssh-agent -s)
51
  - mkdir -p ~/.ssh && chmod 700 ~/.ssh
52 53
  - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
  - ssh-add ~/.ssh/id_rsa
54
  - touch ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts
John Long's avatar
John Long committed
55
  - ssh-keyscan $DEST_HOST >> ~/.ssh/known_hosts 2>&1
56
  - ssh-keyscan $(getent hosts $DEST_HOST | awk '{ print $1 }') >> ~/.ssh/known_hosts 2>&1
57
  - rsync -rvzPtale ssh artifacts/ $DEST_USER@$DEST_HOST:$DEST_DIR/ --delete
John Long's avatar
John Long committed
58 59
      --exclude=.env
      --exclude=storage
60
      --exclude=public/.well-known
John Long's avatar
John Long committed
61
  - ssh $DEST_USER@$DEST_HOST "cd $DEST_DIR; ./artisan migrate --force"
62 63 64 65
  when: manual
  only:
  - master
  dependencies:
66
  - php:7.3
67 68 69 70
  variables:
    GIT_STRATEGY: none
  environment:
    name: production