Files
github-actions-magento2/cache-magento/compute-cache-keys.sh
T
Damien Retzinger 8d00f8149a feat(cache-magento): add stamp caching for vendor/ directory (#245)
Adds an opt-in `stamp` mode that caches the extracted `vendor/`
directory in addition to the Composer download cache. On a warm
hit, `composer install` is effectively a no-op and shaves 2–5
minutes off a full Magento install.
2026-05-09 15:47:53 -04:00

21 lines
630 B
Bash

#!/usr/bin/env bash
# Args: composer_cache_key os php_version composer_version project lock_hash
COMPOSER_CACHE_KEY="$1"
OS="$2"
PHP_VERSION="$3"
COMPOSER_VERSION="$4"
PROJECT="$5"
LOCK_HASH="${6:-}"
MODE="extension"
SUFFIX=""
if [ -n "$PROJECT" ]; then
MODE="store"
[ -n "$LOCK_HASH" ] && SUFFIX=" | $LOCK_HASH"
fi
BASE="composer | v5.8 | ${OS} | ${MODE} | ${COMPOSER_CACHE_KEY} | ${COMPOSER_VERSION} | ${PHP_VERSION}"
echo "download-key=${BASE}${SUFFIX}"
echo "download-restore-key=${BASE}"
echo "stamp-key=composer | stamp | v5.8 | ${OS} | ${MODE} | ${COMPOSER_CACHE_KEY} | ${COMPOSER_VERSION} | ${PHP_VERSION}${SUFFIX}"