diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9dfd545c72fc52d3a9bb5f32779a5c03eb1ec055..6c7da7b3d043a5c02b28eb52767143035f42a825 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,63 +1,69 @@ variables: - SSH_HOST: proserver@vpro0100.proserver.punkt.de - SSH_PATH: /var/www/deploy + GIT_STRATEGY: "none" + GIT_SSL_NO_VERIFY: "true" -cache: - key: "$CI_BUILD_NAME/$CI_BUILD_REF_NAME" - untracked: true - paths: - - .composer/ +before_script: + - apk add bash --update stages: - - test - - build - - deploy - -test: - stage: test - script: echo "Running tests..." + - build + - layout + - deploy build: - image: montoias/docker-nodejs-bower-grunt-compass:v2 - stage: build - before_script: - - cd data/typo3/html/typo3conf/ext/t3olayout/Resources/Private - script: - - npm install - - grunt - artifacts: - paths: - - data/typo3/html/typo3conf/ext/t3olayout/Resources/Public/Css/ - - data/typo3/html/typo3conf/ext/t3olayout/Resources/Public/JavaScript/ + stage: build + variables: + GIT_STRATEGY: "clone" + GIT_SUBMODULE_STRATEGY: "recursive" + script: + - ./.gitlab-ci/scripts/composer.sh config store-auths false + - ./.gitlab-ci/scripts/composer.sh config http-basic.git-t3o.typo3.org gitlab-ci-token ${CI_BUILD_TOKEN} + - ./.gitlab-ci/scripts/composer.sh install + artifacts: + paths: + - ./ + expire_in: '1h' + environment: ${CI_BUILD_REF_NAME} + +layout: + stage: layout + image: montoias/docker-nodejs-bower-grunt-compass:v2 + before_script: + - cd html/typo3conf/ext/t3olayout/Resources/Private + script: + - npm install + - grunt + artifacts: + paths: + - ./ + expire_in: '7d' + environment: ${CI_BUILD_REF_NAME} + dependencies: + - build + +.deploy-template: &deploy_template + stage: deploy + script: + - apk add openssh-client + - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY" | ssh-add - + - php surf.phar simulate Development + when: manual + dependencies: + - layout +deploy-master: + <<: *deploy_template + environment: + name: master + url: https://extensions.typo3.org/ + only: + - master -deploy_staging: - image: webdevops/php:debian-9 - stage: deploy - environment: - name: staging - url: https://vpro0100.proserver.punkt.de - only: - - master - - 9-add-deployment-on-staging-server - before_script: - - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - # Install ssh-agent if not already installed, it is required by Docker. - # (change apt-get to yum if you use a CentOS-based image) - - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' - # Run ssh-agent (inside the build environment) - - eval $(ssh-agent -s) - # Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store - - ssh-add <(echo "$SSH_PRIVATE_KEY") - # For Docker builds disable host key checking. Be aware that by adding that - # you are suspectible to man-in-the-middle attacks. - # WARNING: Use this only with the Docker executor, if you use it with shell - # you will overwrite your user's SSH config. - - mkdir -p ~/.ssh - - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' - - export COMPOSER_CACHE_DIR=.composer - - cd data/typo3/ - script: - - composer install --no-dev - - rsync -az -e "ssh" --delete --exclude=fileadmin --exclude=typo3conf/l10n --exclude=.git --exclude=node_modules --exclude=bower_components --exclude=typo3temp --exclude=.ssh --exclude=.sass-cache --exclude=/uploads ./ $SSH_HOST:$SSH_PATH/ - - ssh $SSH_HOST $SSH_PATH/ci/follow_up.sh +deploy-develop: + <<: *deploy_template + environment: + name: develop + url: https://extensions-dev.typo3.org/ + only: + - develop diff --git a/.gitlab-ci/follow_up.sh b/.gitlab-ci/follow_up.sh deleted file mode 100755 index 5c2f3c55d1fe95899e1544d9a2d3a32c04303dd9..0000000000000000000000000000000000000000 --- a/.gitlab-ci/follow_up.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -cd /var/www/deploy/ - -# Generate PackageState file including all core extensions -bin/typo3cms install:generatepackagestates 0 1 - -bin/typo3cms backend:lock; -bin/typo3cms language:update; -bin/typo3cms database:updateschema; -bin/typo3cms install:fixfolderstructure; -bin/typo3cms cache:flush; -bin/typo3cms backend:unlock; diff --git a/.surf/Development.php b/.surf/Development.php new file mode 100644 index 0000000000000000000000000000000000000000..21f516df290e6477a59baa9e1c1300974eaa7437 --- /dev/null +++ b/.surf/Development.php @@ -0,0 +1,41 @@ +setHostname('vpro0100.proserver.punkt.de') + ->setOption('username', 'proserver'); + +$application = new TYPO3\Surf\Application\TYPO3\CMS('typo3.org'); +$application + ->setOption('applicationWebDirectory', 'html') + ->setOption('TYPO3\\Surf\\Task\\TYPO3\\CMS\\SymlinkDataTask[webDirectory]', 'html') + ->setOption('TYPO3\\Surf\\Task\\TYPO3\\CMS\\SetUpExtensionsTask[scriptFileName]', 'bin/typo3cms') + ->setOption('TYPO3\\Surf\\Task\\TYPO3\\CMS\\FlushCachesTask[scriptFileName]', 'bin/typo3cms') + ->setOption('keepReleases', 3) + ->setOption('composerCommandPath', 'composer') + ->setOption('updateMethod', null) + ->setOption('packageMethod', null) + ->setOption('baseUrl', $baseUrl) + ->setContext('Development') + ->setDeploymentPath($deploymentPath) + ->addNode($node); + +$deployment->addApplication($application); +$deployment->onInitialize(function () use ($deployment) { + $deployment->getWorkflow() + ->setTaskOptions('TYPO3\\Surf\\Task\\Generic\\CreateSymlinksTask', ['symlinks' => ['html/sql' => '../../../shared/Sql']]) + ->removeTask('TYPO3\\Surf\\Task\\TYPO3\\CMS\\CreatePackageStatesTask') + ->defineTask('pt:DeleteDirectoriesTask', 'TYPO3\\Surf\\Task\\ShellTask', [ + 'command' => 'rm -rf {releasePath}/html/fileadmin {releasePath}/html/uploads' + ]) + ->beforeTask('TYPO3\\Surf\\Task\\TYPO3\\CMS\\SymlinkDataTask', 'pt:DeleteDirectoriesTask') + ->defineTask('pt:RestartPhpFpmTask', 'TYPO3\\Surf\\Task\\ShellTask', [ + 'command' => 'sudo /usr/local/etc/rc.d/php-fpm restart' + ]) + ->forStage('cleanup', 'TYPO3\\Surf\\Task\\Generic\\CreateSymlinksTask') + ->forStage('cleanup', 'pt:RestartPhpFpmTask'); +}); diff --git a/surf.phar b/surf.phar new file mode 100644 index 0000000000000000000000000000000000000000..934494aa733f7557335da0e1d50559457a2ab836 Binary files /dev/null and b/surf.phar differ