Skip to content

Instantly share code, notes, and snippets.

@urre
Last active June 28, 2019 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save urre/c808fc8f97c036a8e2cbda99eb359433 to your computer and use it in GitHub Desktop.
Save urre/c808fc8f97c036a8e2cbda99eb359433 to your computer and use it in GitHub Desktop.
CircleCI config for WordPress with Bedrock
version: 2
jobs:
build:
working_directory: ~/clone
docker:
- image: circleci/php:7.1-node-browsers
steps:
- checkout
- run:
name: Composer install
command: composer install --prefer-dist --no-interaction
working_directory: ~/clone/src
- run:
name: Install rsync
command: sudo apt install rsync
- run:
name: Install zip
command: sudo docker-php-ext-install zip
- run:
name: Composer self-update
command: sudo composer self-update
- restore_cache:
keys:
- composer-v1-{{ checksum "src/composer.lock" }}
- composer-v1-
- run:
name: Composer install
command: composer install -n --prefer-dist
working_directory: ~/clone/src
- save_cache:
key: composer-v1-{{ checksum "src/composer.lock" }}
paths:
- vendor
- restore_cache:
keys:
- node-v1-{{ checksum "~/clone/src/web/app/themes/mytheme/package.json" }}
- node-v1-
- run:
name: Npm install
command: yarn install
working_directory: ~/clone/src/web/app/themes/mytheme
- save_cache:
key: node-v1-{{ checksum "~/clone/src/web/app/themes/mytheme/package.json" }}
paths:
- node_modules
- run:
name: Build assets for production
command: yarn run build
working_directory: ~/clone/src/web/app/themes/mytheme
- run:
name: Create hashed asset filenames
command: yarn run rev
working_directory: ~/clone/src/web/app/themes/mytheme
- add_ssh_keys:
fingerprints:
- "XX:XX:XX"
- run:
name: Add server to known_hosts
command: ssh-keyscan -H XXX.XXX.XXX >> ~/.ssh/known_hosts
- run:
name: Rsync config folder
command: rsync -av -e 'ssh -p 22' --delete --progress --exclude '.git' ~/clone/src/config/ $CI_USER@$CI_HOST:$CI_CONFIGPATH
- run:
name: Rsync vendor folder
command: rsync -av -e 'ssh -p 22' --delete --progress --exclude '.git' ~/clone/src/vendor/ $CI_USER@$CI_HOST:$CI_VENDORPATH
- run:
name: Rscync WordPress
command: rsync -av -e 'ssh -p 22' --delete --progress --exclude '.git' --exclude 'node_modules' ~/clone/src/web/wp/ $CI_USER@$CI_HOST:$CI_WPPATH
- run:
name: Rsync app folder
command: rsync -av -e 'ssh -p 22' --delete --progress --exclude '.git' --exclude 'node_modules' --exclude 'uploads' ~/clone/src/web/app/ $CI_USER@$CI_HOST:$CI_APPPATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment