Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,15 @@
when:
- _gitignore_pantheon.stat.exists == true

- name: Work with npm
- name: Work with npm list
include_tasks: "npm.yml"
loop: "{{ pantheon_deploy.build.npm }}"
when: ( pantheon_deploy.build.npm is defined ) and ( pantheon_deploy.build.npm | type_debug == "list" )

- name: Work with npm item
include_tasks: "npm.yml"
loop: "{{ [pantheon_deploy.build.npm] }}"
when: ( pantheon_deploy.build.npm is defined ) and ( pantheon_deploy.build.npm | type_debug != "list" )

- name: Work with secrets
include_tasks: "secrets.yml"
Expand Down
9 changes: 5 additions & 4 deletions tasks/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set_fact:
_npm_dir: "\
{{ _run_temp_dir.path }}/src\
{% if pantheon_deploy.build.npm_dir is defined %}\
/{{ pantheon_deploy.build.npm_dir }}\
{% if item.npm_dir is defined %}\
/{{ item.npm_dir }}\
{% endif %}"

- name: Check if package.json exists
Expand All @@ -13,15 +13,16 @@
register: _package_json

- name: Install NPM
shell: "npm {{ pantheon_deploy.build.npm_install_cmd | default('ci') }}"
shell: "npm {{ item.npm_install_cmd | default('ci') }}"
args:
chdir: "{{ _npm_dir }}"
when:
- _package_json.stat.exists == true

- name: Run npm build
shell: "npm run {{ pantheon_deploy.build.npm_build_script_name | default('build') }}"
shell: "npm run {{ item.npm_build_script_name | default('build') }}"
args:
chdir: "{{ _npm_dir }}"
when:
- _package_json.stat.exists == true

4 changes: 2 additions & 2 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ _pantheon_deploy_defaults:
git_dir: ''
git_branch: 'main'
build:
npm_dir: ''
npm_build_script_name: 'build'
- npm_dir: ''
npm_build_script_name: 'build'
target:
ssh_key_base64: ''
ssh_pub_base64: ''
Expand Down