Skip to content

Commit

Permalink
feat: extract PHP version restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Apr 10, 2021
1 parent 34e4bf5 commit 627dde1
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ update-release:
update-rss:
./scripts/update-rss.sh

update-version-compat:
./scripts/update-version-compat.sh

tag:
./scripts/tag-release.sh

Expand Down
32 changes: 32 additions & 0 deletions scripts/extract-php-version-constraints.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
##
# @license http://unlicense.org/UNLICENSE The UNLICENSE
# @author William Desportes <[email protected]>
##

if ! command -v jq &> /dev/null
then
echo "jq could not be found"
exit 1
fi

set -e

git checkout -q gh-pages > /dev/null

# Only normal releases
FOUND_PHARS="$(find ./releases/ -type f -name 'VERSION' -not -path '*-dev/*' -not -path '*/dev/*' -not -path '*/latest/*' | sort -n)"

VERSION_COMPAT='{}'

for file in $FOUND_PHARS; do
VERSION="$(cat "$file")"
COMPOSER_JSON="$(git show "v${VERSION}:./composer.json")"
REQUIRED_VERSION="$(printf '%s' "${COMPOSER_JSON}" | jq -r .require.php)"
VERSION_COMPAT="$(echo "${VERSION_COMPAT} {\"${VERSION}\": \"${REQUIRED_VERSION}\"}" | jq -s add)"
done

printf '%s' "${VERSION_COMPAT}" | jq -r

git checkout -q - > /dev/null

21 changes: 21 additions & 0 deletions scripts/update-version-compat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
##
# @license http://unlicense.org/UNLICENSE The UNLICENSE
# @author William Desportes <[email protected]>
##

set -e

VERSIONS_COMPAT="$(./scripts/extract-php-version-constraints.sh)"

git checkout gh-pages

printf '%s\n' "${VERSIONS_COMPAT}" > versions-platform-compatibility.json
# Parsing check
jq -r '.' versions-platform-compatibility.json > /dev/null

# Commit the changes
git add -A "versions-platform-compatibility.json"
git commit -S -m "Update the version compatibility file" -m "#versions-compat"

git checkout -

0 comments on commit 627dde1

Please sign in to comment.