.gitlab-ci.yml 2.34 KB
Newer Older
1 2
variables:
    GIT_STRATEGY: "none"
3
    GIT_SSL_NO_VERIFY: "true"
4

5
before_script:
6
    - apk add bash --no-cache
7

8
stages:
9
    - dump
10
    - build
11
    - layout
12 13 14 15
    - deploy

build:
    stage: build
16
    image: composer
17 18 19
    variables:
        GIT_STRATEGY: "clone"
        GIT_SUBMODULE_STRATEGY: "recursive"
20
    script:
21 22 23
        - composer config store-auths false
        - composer config http-basic.git-t3o.typo3.org gitlab-ci-token ${CI_BUILD_TOKEN}
        - composer install
24 25 26
    artifacts:
        paths:
            - ./
27
        expire_in: '1h'
28 29
    except:
        - assets
30

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

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

deploy-master:
    <<: *deploy_template
69 70
    environment:
        name: master
71
        url: https://extensions.typo3.org/
72
    when: manual
73 74 75 76
    only:
        - master

deploy-develop:
77
    <<: *deploy_template
78 79
    environment:
        name: develop
80
        url: https://extensions-stage.typo3.org/
81 82
    only:
        - develop
83 84 85 86

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