How can I first remove old files from the SFTP folder followed by uploading the new files? Currently, it builds but doesn’t overwrite my CSS or JSS files.
Also, how can I have 2 tasks one for Development and one for Production?
IS my config oke? How can i make it even more readable and clean?
version: 2
jobs:
build:
docker:
- image: circleci/node:10.16
branches:
only:
- develop
working_directory: ~/blaat-theme
steps:
- add_ssh_keys:
fingerprints:
- "9e:30:54:a6:0c:9a:3a:54:a7:xx:xx:xx:xx:xx:xx:d4"
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: yarn install
- save_cache: # special step to save the dependency cache
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
# run tests!
- run: yarn prod-build
- checkout
- run: ssh-keyscan ${hostname} >> ~/.ssh/known_hosts
- run: sudo apt-get install rsync
- run:
name: Send Via SSH
command: rsync -avhPX --exclude 'node_modules' --exclude '.git' --exclude 'webpack' --exclude '.circleci' --exclude 'src' --exclude '.babelrc' --exclude '.browserslistrc' --exclude '.eslintrc' --exclude '.gitignore' --exclude '.prettierrc' --exclude '.stylelintignore' --exclude '.stylelintrc' --exclude 'env.json' --exclude 'package.json' --exclude 'yarn.lock' --exclude 'README.md' ~/blaat-theme ${username}@${hostname}:/var/www/html/${site_name}/wp-content/themes/