-
Notifications
You must be signed in to change notification settings - Fork 11
/
release.sh
executable file
·71 lines (66 loc) · 2.13 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
set -eu
EXCLUDED_TAGS='\/1.5|\/1.6.0|alpha|beta|rc|RC|\^'
PRESTASHOP_TAGS=$(git ls-remote --tags git@github.com:PrestaShop/PrestaShop.git | cut -f2 | grep -Ev $EXCLUDED_TAGS | cut -d '/' -f3 | sort -r -V)
# PRESTASHOP_MAJOR_TAGS=$(
# MAJOR_TAGS=""
# for VERSION in $PRESTASHOP_TAGS; do
# CRITERIA=$(echo "$VERSION" | cut -d. -f1)
# # shellcheck disable=SC3010
# if [[ "$CRITERIA" == 1* ]]; then
# CRITERIA=$(echo "$VERSION" | cut -d. -f1-2)
# fi
# if ! echo "$MAJOR_TAGS" | grep -q "^$CRITERIA"; then
# MAJOR_TAGS="$MAJOR_TAGS\n$VERSION";
# fi
# done
# echo "$MAJOR_TAGS"
# )
PRESTASHOP_MINOR_TAGS=$(
MINOR_TAGS=""
for VERSION in $PRESTASHOP_TAGS; do
CRITERIA=$(echo "$VERSION" | cut -d. -f1-2)
# shellcheck disable=SC3010
if [[ "$CRITERIA" == 1* ]]; then
CRITERIA=$(echo "$VERSION" | cut -d. -f1-3)
fi
if ! echo "$MINOR_TAGS" | grep -q "^$CRITERIA"; then
MINOR_TAGS="$MINOR_TAGS\n$VERSION";
fi
done
echo "$MINOR_TAGS"
)
get_compatible_php_version() {
REGEXP_LIST=$(echo "$PRESTASHOP_TAGS" | jq -r 'keys_unsorted | .[]')
while IFS= read -r regExp; do
# shellcheck disable=SC3010
if [[ $1 =~ $regExp ]]; then
echo "$PRESTASHOP_TAGS" | jq -r '."'"${regExp}"'".php.compatible[]'
break;
fi
done <<EOF
$REGEXP_LIST
EOF
}
publish() {
echo "Publishing" "$@"
gh workflow run docker-publish.yml \
--repo prestashop/prestashop-flashlight \
--field target_platforms=linux/amd64,linux/arm64 "$@"
}
# Latest
publish --field ps_version=latest
publish --field ps_version=latest --field os_flavour=debian
# Build & publish every prestashop version with recommended PHP version
for PS_VERSION in $PRESTASHOP_TAGS; do
publish --field ps_version="$PS_VERSION"
publish --field ps_version="$PS_VERSION" --field os_flavour=debian
done
# Build & publish every prestashop minor version with all compatible PHP versions (alpine only)
for PS_VERSION in $PRESTASHOP_MINOR_TAGS; do
while IFS= read -r PHP_VERSION; do
publish --field ps_version="$PS_VERSION" --field php_version="$PHP_VERSION"
done <<EOF
$(get_compatible_php_version "$PS_VERSION")
EOF
done