.gitlab-ci.yml 2.5 KB
Newer Older
Thomas Löffler's avatar
Thomas Löffler committed
1
variables:
2 3
    GIT_STRATEGY: "none"
    GIT_SSL_NO_VERIFY: "true"
Thomas Löffler's avatar
Thomas Löffler committed
4

5
before_script:
6
    - apk add bash --no-cache
Thomas Löffler's avatar
Thomas Löffler committed
7 8

stages:
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
9
    - dump
10 11 12
    - build
    - layout
    - deploy
Thomas Löffler's avatar
Thomas Löffler committed
13 14

build:
15
    stage: build
16
    image: php:7.0-alpine
17 18 19
    variables:
        GIT_STRATEGY: "clone"
        GIT_SUBMODULE_STRATEGY: "recursive"
20 21 22 23 24
    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
25
    script:
26 27 28
        - ./composer.phar config store-auths false
        - ./composer.phar config http-basic.git-t3o.typo3.org gitlab-ci-token ${CI_BUILD_TOKEN}
        - ./composer.phar install
29 30 31 32
    artifacts:
        paths:
            - ./
        expire_in: '1h'
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
33 34 35
    except:
        - assets

36 37 38

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

.deploy-template: &deploy_template
    stage: deploy
56 57
    image:
        name: "torvitas/deployer:4.0.0-alpine"
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
58
        entrypoint: [""]
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
59
    before_script:
Sascha Schmidt's avatar
Sascha Schmidt committed
60
        - mkdir -p /root/.ssh/
61
        - eval $(ssh-agent -s)
62 63 64 65
        - echo "$SSH_PRIVATE_KEY_STAGE" | ssh-add -
        - echo "$SSH_PRIVATE_KEY_PRODUCTION" | ssh-add -
        - ssh-keyscan -p 22191 stage.typo3.org >> /root/.ssh/known_hosts
        - ssh-keyscan -p 22193 typo3.org >> /root/.ssh/known_hosts
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
66
    script:
67
        - dep -f./.gitlab-ci/deployer/deploy.php deploy ${CI_BUILD_REF_NAME}
68 69
    dependencies:
        - layout
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
70 71
    except:
        - assets
72

73 74 75 76
deploy-master:
    <<: *deploy_template
    environment:
        name: master
77
        url: https://typo3.org/
78
    when: manual
79 80
    only:
        - master
Thomas Löffler's avatar
Thomas Löffler committed
81

82 83 84 85
deploy-develop:
    <<: *deploy_template
    environment:
        name: develop
86
        url: https://stage.typo3.org/
87 88
    only:
        - develop
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
89 90 91 92 93 94 95 96 97 98 99

dump-assets:
    <<: *deploy_template
    stage: dump
    image: alpine:3.5
    artifacts:
        paths:
            - ./assets/
        expire_in: '3d'
    script:
      - apk add rsync --no-cache
100
      - rsync -ah -e "ssh -p 22191" tthreeorgstage@stage.typo3.org:ci/shared/ ./assets/
101
      - ssh -p22191 tthreeorgstage@stage.typo3.org "mysqldump -u${STAGE_DATABASE_USER} -p${STAGE_DATABASE_PASSWORD} -h127.0.0.1 tthreeorgstage | gzip -9 -c" > ./assets/db.sql.gz
Sascha Marcel Schmidt's avatar
Sascha Marcel Schmidt committed
102 103 104 105 106
    dependencies:
    when:
    only:
        - assets
    except: