Modifying build-after.yml

I was trying to add bower install, npm install, and gulp --production after the composer update command when doing a deploy. When it gets to the bower install, I get a failed error “no such file or directory”. However when I login and run bower install as the web account in the theme folder, it works just fine?

Here is my new build-after.yml file:

---
- name: Check for composer.json in project root or project_subtree_path
  stat:
    path: "{{ deploy_helper.new_release_path }}/composer.json"
  register: composer_json

- name: Fail if composer.json not found
  fail:
    msg: "Unable to find a `composer.json` file in the root of '{{ deploy_helper.new_release_path }}'. Make sure your repo has a `composer.json` file in its root or edit `subtree_path` for '{{ site }}' in `wordpress_sites.yml` so it points to the directory with a `composer.json` file."
  when: not composer_json.stat.exists

- name: Install Composer dependencies
  command: composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts
  args:
    chdir: "{{ deploy_helper.new_release_path }}"
- name: Install bower 
  command: bower install
  args:
    chdir: "{{ deploy_helper.new_release_path }}/web/app/themes/nwb"
- name: Install npm
  command: npm install
  args:
    chdir: "{{ deploy_helper.new_release_path }}/web/app/themes/nwb"
- name: Build Project with gulp
  command: gulp --production
  args:
    chdir: "{{ deploy_helper.new_release_path }}/web/app/themes/nwb"

I ran the deploy with the -vvv switch, checked the path manually, and it’s the right path to the theme folder. Checked bower install can be run from all accounts, and that was fine too.

Is there a reason why you’re not using the provided build-before.yml example file?

1 Like

Oh, didn’t even know that existed. Looks like I created my project before that was initially committed, but just now doing my first deploy. Oops! :smile:

Modifying my deploy.yml and creating that build-before.yml got a clean deploy process.

Thanks!

Outside of that, is there anything to point out that I did wrong in my original file? I see connection: local is added, but I essentially set it up like the composer install; just confused why it didn’t work.