Commit 6b79cb9f authored by Илья Рассадин's avatar Илья Рассадин
Browse files

Merge branch 'ir-ce-cms-composer' into 'master'

Add cetera-cms deployment to standard composer deploy

See merge request boilerplate/ci!10
parents 8b98160a 33f80c5e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -5,6 +5,13 @@
    composer --no-dev audit;
  fi

.run_composer_post_install: &run_composer_post_install |
  if [ -e $COMPOSER_INSTALL_DIR/composer.lock ] && grep -q '"cetera-labs/cetera-cms"' $COMPOSER_INSTALL_DIR/composer.lock;
  then
    cd $COMPOSER_INSTALL_DIR;
    composer run-script --no-dev post-update-cmd;
  fi

.run_composer_install_prod: &run_composer_install_prod |
  if [ -e $COMPOSER_INSTALL_DIR/composer.json ];
  then
@@ -92,6 +99,7 @@
    - *run_composer_audit
    - *tune_autoload_prod
    - *run_composer_install_prod
    - *run_composer_post_install
  only:
    refs:
      - beta
@@ -103,4 +111,5 @@
  artifacts:
    paths:
      - "vendor/"
      - "www/cms/"
    expire_in: 1 day
+9 −3
Original line number Diff line number Diff line
.upload_composer_files: &upload_composer_files |
  if [ -d "$CI_PROJECT_DIR/$COMPOSER_ARTIFACTS_DIR" ];
  then
    echo "RUNNING rsync -L -avz $RSYNC_PARAMS" \
      "--chown=$user:$group -e ssh" \
      "$CI_PROJECT_DIR/$COMPOSER_ARTIFACTS_DIR $DEPLOY_HOST_PATH/$COMPOSER_SERVER_DIR"
    rsync $RSYNC_ADMIN_PARAMS $RSYNC_PARAMS  -e "ssh $SSH_OPTS" $CI_PROJECT_DIR/$COMPOSER_ARTIFACTS_DIR $DEPLOY_HOST_PATH/$COMPOSER_SERVER_DIR;
  fi

.upload_cms_files: &upload_cms_files |
  if [ -d "$CI_PROJECT_DIR/$CMS_ARTIFACTS_DIR" ];
  then
    rsync $RSYNC_ADMIN_PARAMS $RSYNC_PARAMS  -e "ssh $SSH_OPTS" $CI_PROJECT_DIR/$CMS_ARTIFACTS_DIR $DEPLOY_HOST_PATH/$CMS_SERVER_DIR;
  fi

.deploy_composer_files_to_server:
  extends: .before_deploy_code
  variables:
    RSYNC_PARAMS: '--delete'
    COMPOSER_ARTIFACTS_DIR: vendor/
    COMPOSER_SERVER_DIR: vendor/
    CMS_ARTIFACTS_DIR: www/cms/
    CMS_SERVER_DIR: ${DOC_ROOT_NAME}/cms/
  dependencies:
    - build_composer
    - setup_environment_vars
  script:
    - *upload_composer_files
    - *upload_cms_files
  only:
    refs:
      - beta
+5 −0
Original line number Diff line number Diff line
@@ -49,6 +49,11 @@ def main(output_dir):
        f.write(composer['.upload_composer_files'])
    print(f'Written {path}')

    path = os.path.join(output_dir, 'upload_cms_files.sh')
    with open(path, 'w') as f:
        f.write(composer['.upload_cms_files'])
    print(f'Written {path}')


if __name__ == '__main__':
    main(sys.argv[1] if len(sys.argv) > 1 else '/tmp/generated')
+2 −0
Original line number Diff line number Diff line
<?php
// CMS module fixture for integration tests
+1 −0
Original line number Diff line number Diff line
<!-- stale CMS file: should be removed by rsync --delete -->
Loading