From 0b0f9dce39cc4427410d3f12cd3b9add90ac22d6 Mon Sep 17 00:00:00 2001 From: soyuka Date: Tue, 16 Sep 2025 15:44:03 +0200 Subject: [PATCH] ci: laravel e2e installation --- .github/workflows/ci.yml | 2 ++ subtree.sh | 47 ++++++++++++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ef7a05b620..5b794d374c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1406,6 +1406,8 @@ jobs: - name: Install api-platform/laravel run: | composer global link ../src/Laravel --permanent + composer config minimum-stability dev + composer config prefer-stable true composer require api-platform/laravel:"@dev" php ./artisan api-platform:install working-directory: 'test-api-platform-install' diff --git a/subtree.sh b/subtree.sh index afc2cb095a9..b03b9db8dc1 100755 --- a/subtree.sh +++ b/subtree.sh @@ -2,13 +2,42 @@ set -xe -# Subtree split on tag this script gets called using find: -# find src -maxdepth 2 -name composer.json -print0 | xargs -I '{}' -n 1 -0 bash subtree.sh {} refs/tags/3.1.5 -# find src -maxdepth 2 -name composer.json -print0 | xargs -I '{}' -n 1 -0 bash subtree.sh {} refs/heads/3.1 -# See the subtree workflow -package=$(jq -r .name $1) -directory=$(dirname $1) +FORCE_FLAG="" + +while getopts "f" opt; do + case $opt in + f) + FORCE_FLAG="-f" + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + exit 1 + ;; + esac +done +shift $((OPTIND-1)) + + +# The first argument is now the path to composer.json +COMPOSER_JSON_PATH=$1 +# The second argument is the git ref +GIT_REF=$2 + +if [ -z "$COMPOSER_JSON_PATH" ] || [ -z "$GIT_REF" ]; then + echo "Usage: $0 [-f] " + exit 1 +fi + +package=$(jq -r .name "$COMPOSER_JSON_PATH") +directory=$(dirname "$COMPOSER_JSON_PATH") repository="https://github.com/$package" -git remote add $package $repository -sha=$(splitsh-lite --prefix=$directory) -git push $package $sha:$2 + +# Add the remote only if it doesn't exist already +if ! git remote get-url "$package" > /dev/null 2>&1; then + git remote add "$package" "$repository" +fi + +sha=$(splitsh-lite --prefix="$directory") +git push $FORCE_FLAG "$package" "$sha":"$GIT_REF" + +