-
-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build-before: Checkout project source code to local temporary directo…
…ry and compile multiple sage themes
- Loading branch information
Showing
5 changed files
with
58 additions
and
28 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,56 @@ | ||
# Placeholder `deploy_build_before` hook for building theme assets on the | ||
# `deploy_build_before` hook for building theme assets on the | ||
# host machine and then copying the files to the remote server | ||
# | ||
# ⚠️ This example assumes your theme is using Sage 9 | ||
# ⚠️ This assumes your theme is using Sage 9 | ||
# An example for themes built with Sage 8 can be found at: https://git.io/vdgUt | ||
# | ||
# Uncomment the lines below and replace `sage` with your theme folder | ||
# | ||
# --- | ||
# - name: Install npm dependencies | ||
# command: yarn | ||
# connection: local | ||
# args: | ||
# chdir: "{{ project_local_path }}/web/app/themes/sage" | ||
# | ||
# - 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 }}/web/app/themes/sage" | ||
# Define an array of `sage_themes` in `group_vars/<env>/wordpress_sites.yml`, e,g: | ||
# wordpress_sites: | ||
# example.com: | ||
# sage_themes: | ||
# - my-first-sage-theme-name | ||
# - my-second-sage-theme-name | ||
# | ||
# - name: Compile assets for production | ||
# command: yarn build:production | ||
# connection: local | ||
# args: | ||
# chdir: "{{ project_local_path }}/web/app/themes/sage" | ||
# | ||
# - name: Copy production assets | ||
# synchronize: | ||
# src: "{{ project_local_path }}/web/app/themes/sage/dist" | ||
# dest: "{{ deploy_helper.new_release_path }}/web/app/themes/sage" | ||
# group: no | ||
# owner: no | ||
# rsync_opts: --chmod=Du=rwx,--chmod=Dg=rx,--chmod=Do=rx,--chmod=Fu=rw,--chmod=Fg=r,--chmod=Fo=r | ||
# --- | ||
- block: | ||
- name: Clone project files | ||
git: | ||
repo: "{{ project_git_repo }}" | ||
version: "{{ project_version }}" | ||
dest: "{{ project_build_path }}" | ||
force: yes | ||
no_log: true | ||
connection: local | ||
|
||
- name: Install npm dependencies | ||
command: yarn | ||
connection: local | ||
args: | ||
chdir: "{{ project_build_site_path }}/web/app/themes/{{ item }}" | ||
with_items: "{{ project.sage_themes }}" | ||
|
||
- 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 }}/web/app/themes/{{ item }}" | ||
with_items: "{{ project.sage_themes }}" | ||
|
||
- name: Compile assets for production | ||
command: yarn build:production | ||
connection: local | ||
args: | ||
chdir: "{{ project_build_site_path }}/web/app/themes/{{ item }}" | ||
with_items: "{{ project.sage_themes }}" | ||
|
||
- name: Copy production assets | ||
synchronize: | ||
src: "{{ project_build_site_path }}/web/app/themes/{{ item }}/dist" | ||
dest: "{{ deploy_helper.new_release_path }}/web/app/themes/{{ item }}" | ||
group: no | ||
owner: no | ||
rsync_opts: --chmod=Du=rwx,--chmod=Dg=rx,--chmod=Do=rx,--chmod=Fu=rw,--chmod=Fg=r,--chmod=Fo=r | ||
with_items: "{{ project.sage_themes }}" | ||
|
||
when: project.sage_themes is defined |
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
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
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