.gitlab-ci.yml 2.46 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: composer
22 23 24
    variables:
        GIT_STRATEGY: "clone"
        GIT_SUBMODULE_STRATEGY: "recursive"
25
    script:
26
        - composer config store-auths false
27
        - composer config platform.php 7.0
28 29
        - composer config http-basic.git-t3o.typo3.org gitlab-ci-token ${CI_BUILD_TOKEN}
        - composer install
30 31 32
    artifacts:
        paths:
            - ./
33
        expire_in: '1h'
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
    artifacts:
        paths:
          - ./
        expire_in: '7d'
49 50
    dependencies:
        - build
51 52
    except:
        - assets
53

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

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

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

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