Skip to content

Instantly share code, notes, and snippets.

@craigmdennis
Last active September 30, 2019 13:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigmdennis/d5d5e172d3f9f1eb21f96b5ee56d9960 to your computer and use it in GitHub Desktop.
Save craigmdennis/d5d5e172d3f9f1eb21f96b5ee56d9960 to your computer and use it in GitHub Desktop.
Configure Circle CI to deploy Trellis
- name: Run npm install
command: npm install
connection: local
args:
chdir: "{{ project.local_path }}/web/app"
tags: skip-using-ci
- name: Rebuild Node Sass
command: npm rebuild node-sass
connection: local
args:
chdir: "{{ project.local_path }}/web/app"
tags: skip-using-ci
- name: Run gulp
command: npm run production
connection: local
args:
chdir: "{{ project.local_path }}/web/app"
tags: skip-using-ci
- name: Copy project local files
synchronize:
src: "{{ project.local_path }}/web/app/themes"
dest: "{{ deploy_helper.new_release_path }}/web/app/themes"
group: no
owner: no
rsync_opts: --chmod=Du=rwx,--chmod=Dg=rx,--chmod=Do=rx,--chmod=Fu=rw,--chmod=Fg=r,--chmod=Fo=r
# Set the folder under which commands will be executed
general:
build_dir: site
# Configure the machine
machine:
timezone:
Europe/London
node:
version: 6.0.0
python:
version: 2.7.10
dependencies:
pre:
# Allow ansible playbooks to be run
- pip install ansible
# Turn an environment variable into a vault file that ansible can read
- cd ../trellis && echo "${ANSIBLE_VAULT_PASSWORD}" > .vault_pass
# This _should_ be inferred by Circle CI as we specify a node version but for some reason, it never ran for me. This tells it explicitly to run.
override:
- npm install
test:
# Again, this _should_ be inferred by Circle CI but wasn't.
override:
- npm run test
# Deployment Scenarios
deployment:
staging:
branch: staging
commands:
# This is just an ansible playbook command with some options to specify where the host file is located and that we want to skip tasks with the tag `skip-using-ci`
- cd ../trellis && ansible-playbook deploy.yml -e "site=example.com env=staging" -i hosts/staging --skip-tags "skip-using-ci" -vvv
@partounian
Copy link

partounian commented Aug 11, 2017

What kind of tests do you have written and what do you gain from CI in this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment