-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turn composer install into an action and use it in sanity as well
- Loading branch information
1 parent
6644f1e
commit 3bf6bdb
Showing
3 changed files
with
58 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Install composer dependencies | ||
description: Install composer dependencies | ||
inputs: | ||
ps_dir: | ||
description: PrestaShop folder | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
# Install composer vendors (must be done before building assets as classic theme is fetched from composer) | ||
- name: Get Composer Cache Directory | ||
id: composer-cache-dir | ||
run: | | ||
echo "composer-cache-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
working-directory: ${{ inputs.ps_dir }} | ||
shell: bash | ||
|
||
# Split composer caches into two steps, because the default automatic process always took some time on cleanup for unknown reason | ||
# Restore composer cache dir and vendor | ||
- name: Restore composer cache dir | ||
uses: actions/cache/restore@v3 | ||
id: composer-cache | ||
with: | ||
path: ${{ steps.composer-cache-dir.outputs.composer-cache-dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
- name: Restore composer vendor folder | ||
uses: actions/cache/restore@v3 | ||
id: vendor-cache | ||
with: | ||
path: ${{ inputs.ps_dir }}/vendor | ||
key: ${{ runner.os }}-vendor-${{ hashFiles('**/composer.lock') }} | ||
|
||
# Run composer install | ||
- name: Install Composer dependencies | ||
run: composer install --prefer-dist --optimize-autoloader | ||
working-directory: ${{ inputs.ps_dir }} | ||
shell: bash | ||
|
||
# Cache composer cache dir and vendor | ||
- name: Save composer vendor folder | ||
uses: actions/cache/save@v3 | ||
if: steps.vendor-cache.outputs.cache-hit != 'true' | ||
with: | ||
path: ${{ inputs.ps_dir }}/vendor | ||
key: ${{ steps.vendor-cache.outputs.cache-primary-key }} | ||
- name: Save composer cache dir | ||
uses: actions/cache/save@v3 | ||
if: steps.composer-cache.outputs.cache-hit != 'true' | ||
with: | ||
path: ${{ steps.composer-cache-dir.outputs.composer-cache-dir }} | ||
key: ${{ steps.composer-cache.outputs.cache-primary-key }} |
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