Last active
February 20, 2020 10:32
-
-
Save adriandmitroca/2924dc49e79affb41030cb2067203520 to your computer and use it in GitHub Desktop.
CircleCI Deployment Recipe with assets building (Yarn with cache support) & git-ftp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
docker: | |
- image: circleci/php:7.2-node-browsers | |
working_directory: ~/repo | |
steps: | |
- checkout | |
- run: sudo apt update && sudo apt install libpng-dev | |
- run: sudo rm -rf git-ftp && git clone https://github.com/git-ftp/git-ftp.git && cd git-ftp && tag="$(git tag | grep '^[0-9]*\.[0-9]*\.[0-9]*$' | tail -1)" && git checkout "$tag" && sudo make install | |
- restore_cache: | |
keys: | |
- node-v1-{{ checksum "package.json" }} | |
- node-v1- | |
- run: yarn install | |
- save_cache: | |
key: node-v1-{{ checksum "package.json" }} | |
paths: | |
- node_modules | |
- ~/.yarn | |
- run: yarn lint | |
- run: yarn prod | |
- deploy: | |
command: | | |
git reset --hard | |
if [ "${CIRCLE_BRANCH}" == "staging" ]; then | |
git ftp push --auto-init -u ${FTP_USERNAME_STAGING} -p ${FTP_PASS_STAGING} -v ftp://YOUR-HOSTNAME.com/wp-content/themes/mimeeq | |
elif [ "${CIRCLE_BRANCH}" == "master" ]; then | |
git ftp push --auto-init -u ${FTP_USERNAME_PROD} -p ${FTP_PASS_PROD} -v ftp://YOUR-HOSTNAME.com/wp-content/themes/mimeeq | |
fi | |
workflows: | |
version: 2 | |
build-deploy: | |
jobs: | |
- build: | |
filters: | |
branches: | |
only: | |
- master | |
- staging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment