Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
47 changes: 38 additions & 9 deletions subtree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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] <path-to-composer.json> <git-ref>"
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"


Loading