.gitlab-ci.yml 2.43 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/cache/
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 27 28
        - composer config store-auths false
        - composer config http-basic.git-t3o.typo3.org gitlab-ci-token ${CI_BUILD_TOKEN}
        - composer install
29 30 31
    artifacts:
        paths:
            - ./
32
        expire_in: '1h'
33 34
    except:
        - assets
35

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

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

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

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

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