.gitlab-ci.yml 2.64 KB
Newer Older
Thomas Löffler's avatar
Thomas Löffler committed
1 2 3
cache:
  key: "$CI_COMMIT_REF_NAME/$CI_JOB_STAGE"
  paths:
4
    - /composer
Thomas Löffler's avatar
Thomas Löffler committed
5

6 7
variables:
    GIT_STRATEGY: "none"
8
    GIT_SSL_NO_VERIFY: "true"
9

10
before_script:
11
    - apk add bash --no-cache
12

13
stages:
14
    - dump
15
    - build
16
    - layout
17 18 19 20
    - deploy

build:
    stage: build
21
    image: php:7.0-alpine
22 23 24
    variables:
        GIT_STRATEGY: "clone"
        GIT_SUBMODULE_STRATEGY: "recursive"
25 26 27 28 29
    before_script:
        - apk add bash --no-cache
        - apk add git --update
        - curl https://getcomposer.org/composer.phar -o composer.phar --silent
        - chmod +x composer.phar
30
    script:
31 32 33
        - ./composer.phar config store-auths false
        - ./composer.phar config http-basic.git-t3o.typo3.org gitlab-ci-token ${CI_BUILD_TOKEN}
        - ./composer.phar install
34 35 36
    artifacts:
        paths:
            - ./
37
        expire_in: '1h'
38 39
    except:
        - assets
40

41 42
layout:
    stage: layout
43
    image: node:latest
44
    before_script:
45
       - cd html/typo3conf/ext/t3olayout/Build
46
    script:
47 48
       - npm install
       - npm run build
49 50 51 52
    artifacts:
        paths:
          - ./
        expire_in: '7d'
53 54
    dependencies:
        - build
55 56
    except:
        - assets
57

58
.deploy-template: &deploy_template
59
    stage: deploy
60
    image:
61
        name: "torvitas/deployer:4.0.0-alpine"
62
        entrypoint: [""]
63
    before_script:
64
        - mkdir -p /root/.ssh/
65
        - eval $(ssh-agent -s)
66 67 68
        - echo "$SSH_PRIVATE_KEY_STAGE" | ssh-add -
        - echo "$SSH_PRIVATE_KEY_PRODUCTION" | ssh-add -
        - ssh-keyscan -p 22191 extensions-stage.typo3.org >> /root/.ssh/known_hosts
69
        - ssh-keyscan -p 22192 extensions.typo3.org >> /root/.ssh/known_hosts
70
    script:
71
        - dep -f./.gitlab-ci/deployer/deploy.php deploy -vvv ${CI_BUILD_REF_NAME}
72 73
    dependencies:
        - layout
74 75
    except:
        - assets
76 77 78

deploy-master:
    <<: *deploy_template
79 80
    environment:
        name: master
81
        url: https://extensions.typo3.org/
82
    when: manual
83 84 85 86
    only:
        - master

deploy-develop:
87
    <<: *deploy_template
88 89
    environment:
        name: develop
90
        url: https://extensions-stage.typo3.org/
91 92
    only:
        - develop
93 94 95 96

dump-assets:
    <<: *deploy_template
    stage: dump
97
    image: alpine:3.5
98 99 100
    artifacts:
        paths:
            - ./assets/
101
        expire_in: '3d'
102
    script:
103
      - apk add rsync --no-cache
Thomas Löffler's avatar
Thomas Löffler committed
104 105
      - rsync -ah -e "ssh -p 22191" extensionsstage@extensions-stage.typo3.org:ci/shared/ ./assets/
      - ssh -p22191 extensionsstage@extensions-stage.typo3.org "mysqldump -u${DEV_DATABASE_USER} -p${DEV_DATABASE_PASSWORD} -h127.0.0.1 extensionsstage | gzip -9 -c" > ./assets/db.sql.gz
106 107
    dependencies:
    when:
108
    only:
109
        - assets
110
    except: