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

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: composer
22 23 24
    variables:
        GIT_STRATEGY: "clone"
        GIT_SUBMODULE_STRATEGY: "recursive"
Thomas Löffler's avatar
Thomas Löffler committed
25 26
    before_script:
        - export COMPOSER_CACHE_DIR=/cache/composer
27
    script:
28 29 30
        - composer config store-auths false
        - composer config http-basic.git-t3o.typo3.org gitlab-ci-token ${CI_BUILD_TOKEN}
        - composer install
31 32 33
    artifacts:
        paths:
            - ./
34
        expire_in: '1h'
35 36
    except:
        - assets
37

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

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

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

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

dump-assets:
    <<: *deploy_template
    stage: dump
94
    image: alpine:3.5
95 96 97
    artifacts:
        paths:
            - ./assets/
98
        expire_in: '3d'
99
    script:
100
      - apk add rsync --no-cache
Thomas Löffler's avatar
Thomas Löffler committed
101 102
      - 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
103 104
    dependencies:
    when:
105
    only:
106
        - assets
107
    except: