-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58bb3c9
commit 1ca9184
Showing
3 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
MIN_VERSION=$([[ $(cat appinfo/info.xml) =~ $(echo 'min-version=[^[0-9]]*([0-9]+).*') ]] && echo ${BASH_REMATCH[1]}) | ||
MAX_VERSION=$([[ $(cat appinfo/info.xml) =~ $(echo 'max-version=[^[0-9]]*([0-9]+).*') ]] && echo ${BASH_REMATCH[1]}) | ||
|
||
BASE_TEMPLATE='matrix={"include":[VERSIONS]}' | ||
VERSION_TEMPLATE='{"nextcloud_version":"NEXTCLOUD_VERSION"}' | ||
|
||
|
||
if [ -z "$MIN_VERSION" ] && [ -z "$MAX_VERSION" ]; then | ||
echo 'matrix={"include":[{"nextcloud_version":"29"}]}' | ||
exit 0 | ||
fi | ||
|
||
if [ -z "$MIN_VERSION" ] && [ -n "$MAX_VERSION" ] ; then | ||
VERSIONS=$(echo $VERSION_TEMPLATE | sed "s/NEXTCLOUD_VERSION/$MAX_VERSION/g") | ||
echo $BASE_TEMPLATE | sed "s/VERSIONS/$VERSIONS/g" | ||
exit 0 | ||
fi | ||
|
||
if [ -n "$MIN_VERSION" ] && [ -z "$MAX_VERSION" ] ; then | ||
VERSIONS=$(echo $VERSION_TEMPLATE | sed "s/NEXTCLOUD_VERSION/$MIN_VERSION/g") | ||
echo $BASE_TEMPLATE | sed "s/VERSIONS/$VERSIONS/g" | ||
fi | ||
|
||
if [ "$MIN_VERSION" -eq "$MAX_VERSION" ]; then | ||
VERSIONS=$(echo $VERSION_TEMPLATE | sed "s/NEXTCLOUD_VERSION/$MIN_VERSION/g") | ||
echo $BASE_TEMPLATE | sed "s/VERSIONS/$VERSIONS/g" | ||
exit 0 | ||
fi | ||
|
||
if [ "$MIN_VERSION" -gt "$MAX_VERSION" ]; then | ||
echo 'Min version should be less or equal to max version' | ||
exit 1 | ||
fi | ||
|
||
VERSION_TEMPLATE='{"nextcloud_version":"NEXTCLOUD_VERSION"}' | ||
VERSIONS="" | ||
for i in $(eval echo {$MIN_VERSION..$MAX_VERSION}) | ||
do | ||
VERSIONS="$VERSIONS,$(echo $VERSION_TEMPLATE | sed "s/NEXTCLOUD_VERSION/$i/g")" | ||
done | ||
echo $BASE_TEMPLATE | sed "s/VERSIONS/$VERSIONS/g" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters