mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
54 lines
1.7 KiB
YAML
54 lines
1.7 KiB
YAML
name: "Cache Magento 2 for Pipeline"
|
|
author: "Graycore"
|
|
description: "A Github Action that creates a composer cache for a Magento extension or store."
|
|
|
|
inputs:
|
|
composer_cache_key:
|
|
required: false
|
|
default: "__mageos"
|
|
description: A key to version the composer cache. Can be incremented if you need to bust the cache.
|
|
|
|
outputs:
|
|
cache-hit:
|
|
description: "A boolean value to indicate an exact match was found for the key"
|
|
value: ${{ steps.cache-magento-cache.outputs.cache-hit }}
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Get Composer Cache Directory
|
|
shell: bash
|
|
id: cache-magento-composer-cache
|
|
run: |
|
|
echo "dir=$(composer config cache-files-dir --global)" >> $GITHUB_OUTPUT
|
|
|
|
- run: echo "version=$(php -v | awk 'NR==1{print $2}')" >> "$GITHUB_OUTPUT"
|
|
shell: bash
|
|
id: cache-magento-get-php-version
|
|
|
|
- run: echo "version=$(composer --version | awk '{print $3}')" >> "$GITHUB_OUTPUT"
|
|
shell: bash
|
|
name: Compute Composer Version
|
|
id: cache-magento-get-composer-version
|
|
|
|
- name: Compute cache keys
|
|
id: cache-magento-keys
|
|
shell: bash
|
|
run: |
|
|
bash "${{ github.action_path }}/compute-cache-keys.sh" \
|
|
"${{ inputs.composer_cache_key }}" \
|
|
"${{ steps.cache-magento-get-php-version.outputs.version }}" \
|
|
"${{ steps.cache-magento-get-composer-version.outputs.version }}" \
|
|
>> $GITHUB_OUTPUT
|
|
|
|
- name: "Cache Composer Packages"
|
|
uses: actions/cache@v5
|
|
id: cache-magento-cache
|
|
with:
|
|
key: ${{ steps.cache-magento-keys.outputs.download-key }}
|
|
path: ${{ steps.cache-magento-composer-cache.outputs.dir }}
|
|
|
|
branding:
|
|
icon: "code"
|
|
color: "green"
|