diff --git a/.circleci/config.yml b/.circleci/config.yml index a4516a8..3c1334d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,9 +21,53 @@ jobs: npm ci npm run test npm run build + deploy_theme_staging: + docker: + - image: circleci/php:7.3-node-browsers + steps: + - checkout + - add_ssh_keys: + fingerprints: + - "c0:36:87:5e:a5:8f:b7:6e:62:d0:3e:3f:de:56:06:56" + - run: + name: "Build theme" + command: | + yarn + yarn build:production + composer install --no-dev --optimize-autoloader + - run: sudo apt-get install -y lftp + - run: lftp -c 'set sftp:auto-confirm yes; set sftp:connect-program "ssh -p 22222 -a -x -i ~/.ssh/id_rsa"; connect sftp://'"$SFTP_USERNAME"':'"$SFTP_PASSWORD"'@'"$SFTP_HOSTNAME"' -e "mirror -v -R --exclude docs/ --exclude .cache-loader/ --exclude .git/ --exclude .circleci/ --exclude node_modules/ --exclude resources/assets/ ./ '"$WEB_ROOT_STAGING"'/wp-content/themes/'"$THEME_NAME"'; quit"' + deploy_theme_production: + docker: + - image: circleci/php:7.3-node-browsers + steps: + - checkout + - add_ssh_keys: + fingerprints: + - "c0:36:87:5e:a5:8f:b7:6e:62:d0:3e:3f:de:56:06:56" + - run: + name: "Build theme" + command: | + yarn + yarn build:production + composer install --no-dev --optimize-autoloader + - run: sudo apt-get install -y lftp + - run: lftp -c 'set sftp:auto-confirm yes; set sftp:connect-program "ssh -p 22222 -a -x -i ~/.ssh/id_rsa"; connect sftp://'"$SFTP_USERNAME"':'"$SFTP_PASSWORD"'@'"$SFTP_HOSTNAME"' -e "mirror -v -R --exclude docs/ --exclude .cache-loader/ --exclude .git/ --exclude .circleci/ --exclude node_modules/ --exclude resources/assets/ ./ '"$WEB_ROOT_PRODUCTION"'/wp-content/themes/'"$THEME_NAME"'; quit"' workflows: version: 2 - test: + test_and_deploy: jobs: - test + - deploy_theme_staging: + requires: + - test + filters: + branches: + only: dev + # - deploy_theme_production: + # requires: + # - test + # filters: + # branches: + # only: master