diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 878d00b..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,192 +0,0 @@ -image: grifart/php8.1-with-all-modules-and-various-tools - - -# STAGES - -stages: - - build - - test - - pack - - deploy - - -# GLOBAL TEMPLATES - -.only-staging: &only-staging - except: - refs: - - tags - -.only-production: &only-production - # tags that ends with --production - # valid deploy tags are: - # - 2028-01-03--23-59--production - only: - refs: - - tags - variables: - - $CI_COMMIT_TAG =~ /--production$/ - - - -# BUILDS - -# composer - -build.composer: - stage: build - - artifacts: - expire_in: 1 day - name: "${CI_BUILD_REF_NAME}_${CI_BUILD_NAME}" - paths: - - vendor - - script: - - 'composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader --ansi' - - -# gulp - -build.frontend: - stage: build - - artifacts: - name: "${CI_BUILD_REF_NAME}_${CI_BUILD_NAME}" - - paths: # note that you have to add a path also to the pack stage of this CI configuration - - UI/AboutStructure/assets/dist - - UI/Contacts/assets/dist - - UI/Event/assets/dist - - UI/Rentals/assets/dist - - frontend/dist - - hb-events/build - expire_in: 1 day - - script: - - 'yarn install && NODE_ENV=production yarn build' - - 'cd hb-events && yarn install && yarn build' - - - - -# PACKAGE - -.pack-template: &pack-template - stage: pack - - before_script: ['echo "Packing artifacts together..."'] - - artifacts: &pack-template-artifacts - paths: - - brontosaurus-theme.zip - - script: - - 'zip -r brontosaurus-theme.zip . - -i "config/*" - -i "CoordinatesResolver/*" - -i "DataContainers/*" - -i "frontend/*" - -x "frontend/src/*" - -i "hb-events/*" - -x "hb-events/src/*" - -i "log/*" - -i "Rewrites/*" - -i "template-parts/*" - -i "UI/*" - -x "UI/AboutStructure/assets/src/*" - -x "UI/Contacts/assets/src/*" - -x "UI/Event/assets/src/*" - -x "UI/Rentals/assets/src/*" - -i "vendor/*" - -i "ApplicationUrlTemplate.php" - -i "Assets.php" - -i "archive-novinky.php" - -i "bootstrap.php" - -i "composer.json" - -i "composer.lock" - -i "Configuration.php" - -i "Container.php" - -i "exceptions.php" - -i "footer.php" - -i "functions.php" - -i "header.php" - -i "helpers.php" - -i "index.php" - -i "PostTypeInitializer.php" - -i "screenshot.png" - -i "single-novinky.php" - -i "style.css"' - - dependencies: - - build.composer - - build.frontend - -pack.staging: - <<: *pack-template - <<: *only-staging - - artifacts: - <<: *pack-template-artifacts - expire_in: 1 week - -pack.production: - <<: *pack-template - <<: *only-production - - - -# DEPLOY - -.deploy-template: &deploy-template - stage: deploy - interruptible: false - - artifacts: - expire_in: 2 weeks - paths: - - log/ - when: on_failure - - before_script: - # add server to `.ssh/known_hosts` - - mkdir -p /root/.ssh - - touch /root/.ssh/known_hosts - - echo "$SERVER_KEYSCAN" >> /root/.ssh/known_hosts - - # add private & public key pair for authorization against server - - echo "$KEY_PRIVATE" > /root/.ssh/id_rsa - - echo "$KEY_PUBLIC" > /root/.ssh/id_rsa.pub - - - unzip brontosaurus-theme.zip -d deploy/files - - -deploy.staging: - <<: *deploy-template - <<: *only-staging - - dependencies: - - pack.staging - - environment: - name: staging - url: https://dev.brontosaurus.cz - - script: - - "bash deploy/deploy.sh $STAGING_REMOTE_USER_AND_HOST:$STAGING_REMOTE_PROJECT_DIR/wp-content/themes/brontosaurus-theme" - - "ssh $STAGING_REMOTE_USER_AND_HOST \"rm -rf $STAGING_REMOTE_PROJECT_DIR/wp-content/themes/brontosaurus-theme/temp/cache\"" - -deploy.production: - <<: *deploy-template - <<: *only-production - - dependencies: - - pack.production - - environment: - name: production - url: https://brontosaurus.cz - - script: - - "bash deploy/deploy.sh $PRODUCTION_REMOTE_USER_AND_HOST:$PRODUCTION_REMOTE_PROJECT_DIR/wp-content/themes/brontosaurus-theme" - - "ssh $PRODUCTION_REMOTE_USER_AND_HOST \"rm -rf $PRODUCTION_REMOTE_PROJECT_DIR/wp-content/themes/brontosaurus-theme/temp/cache\""