Skip to content

Commit 627dde1

Browse files
committed
feat: extract PHP version restrictions
1 parent 34e4bf5 commit 627dde1

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ update-release:
1313
update-rss:
1414
./scripts/update-rss.sh
1515

16+
update-version-compat:
17+
./scripts/update-version-compat.sh
18+
1619
tag:
1720
./scripts/tag-release.sh
1821

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
##
3+
# @license http://unlicense.org/UNLICENSE The UNLICENSE
4+
# @author William Desportes <[email protected]>
5+
##
6+
7+
if ! command -v jq &> /dev/null
8+
then
9+
echo "jq could not be found"
10+
exit 1
11+
fi
12+
13+
set -e
14+
15+
git checkout -q gh-pages > /dev/null
16+
17+
# Only normal releases
18+
FOUND_PHARS="$(find ./releases/ -type f -name 'VERSION' -not -path '*-dev/*' -not -path '*/dev/*' -not -path '*/latest/*' | sort -n)"
19+
20+
VERSION_COMPAT='{}'
21+
22+
for file in $FOUND_PHARS; do
23+
VERSION="$(cat "$file")"
24+
COMPOSER_JSON="$(git show "v${VERSION}:./composer.json")"
25+
REQUIRED_VERSION="$(printf '%s' "${COMPOSER_JSON}" | jq -r .require.php)"
26+
VERSION_COMPAT="$(echo "${VERSION_COMPAT} {\"${VERSION}\": \"${REQUIRED_VERSION}\"}" | jq -s add)"
27+
done
28+
29+
printf '%s' "${VERSION_COMPAT}" | jq -r
30+
31+
git checkout -q - > /dev/null
32+

scripts/update-version-compat.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
##
3+
# @license http://unlicense.org/UNLICENSE The UNLICENSE
4+
# @author William Desportes <[email protected]>
5+
##
6+
7+
set -e
8+
9+
VERSIONS_COMPAT="$(./scripts/extract-php-version-constraints.sh)"
10+
11+
git checkout gh-pages
12+
13+
printf '%s\n' "${VERSIONS_COMPAT}" > versions-platform-compatibility.json
14+
# Parsing check
15+
jq -r '.' versions-platform-compatibility.json > /dev/null
16+
17+
# Commit the changes
18+
git add -A "versions-platform-compatibility.json"
19+
git commit -S -m "Update the version compatibility file" -m "#versions-compat"
20+
21+
git checkout -

0 commit comments

Comments
 (0)