Skip to content

Commit 510fa55

Browse files
authored
ci: laravel e2e installation (#7388)
1 parent 051ee7e commit 510fa55

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,8 @@ jobs:
14061406
- name: Install api-platform/laravel
14071407
run: |
14081408
composer global link ../src/Laravel --permanent
1409+
composer config minimum-stability dev
1410+
composer config prefer-stable true
14091411
composer require api-platform/laravel:"@dev"
14101412
php ./artisan api-platform:install
14111413
working-directory: 'test-api-platform-install'

subtree.sh

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,42 @@
22

33
set -xe
44

5-
# Subtree split on tag this script gets called using find:
6-
# find src -maxdepth 2 -name composer.json -print0 | xargs -I '{}' -n 1 -0 bash subtree.sh {} refs/tags/3.1.5
7-
# find src -maxdepth 2 -name composer.json -print0 | xargs -I '{}' -n 1 -0 bash subtree.sh {} refs/heads/3.1
8-
# See the subtree workflow
9-
package=$(jq -r .name $1)
10-
directory=$(dirname $1)
5+
FORCE_FLAG=""
6+
7+
while getopts "f" opt; do
8+
case $opt in
9+
f)
10+
FORCE_FLAG="-f"
11+
;;
12+
\?)
13+
echo "Invalid option: -$OPTARG" >&2
14+
exit 1
15+
;;
16+
esac
17+
done
18+
shift $((OPTIND-1))
19+
20+
21+
# The first argument is now the path to composer.json
22+
COMPOSER_JSON_PATH=$1
23+
# The second argument is the git ref
24+
GIT_REF=$2
25+
26+
if [ -z "$COMPOSER_JSON_PATH" ] || [ -z "$GIT_REF" ]; then
27+
echo "Usage: $0 [-f] <path-to-composer.json> <git-ref>"
28+
exit 1
29+
fi
30+
31+
package=$(jq -r .name "$COMPOSER_JSON_PATH")
32+
directory=$(dirname "$COMPOSER_JSON_PATH")
1133
repository="https://github.com/$package"
12-
git remote add $package $repository
13-
sha=$(splitsh-lite --prefix=$directory)
14-
git push $package $sha:$2
34+
35+
# Add the remote only if it doesn't exist already
36+
if ! git remote get-url "$package" > /dev/null 2>&1; then
37+
git remote add "$package" "$repository"
38+
fi
39+
40+
sha=$(splitsh-lite --prefix="$directory")
41+
git push $FORCE_FLAG "$package" "$sha":"$GIT_REF"
42+
43+

0 commit comments

Comments
 (0)