Skip to content

Commit df07a1d

Browse files
committed
Ensure releases and RCs always have a corresponding pair
Also, adjust the way `versions.json` gets written for more human-powered field ordering.
1 parent d21ab07 commit df07a1d

File tree

2 files changed

+33
-34
lines changed

2 files changed

+33
-34
lines changed

versions.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"8.1": {
3+
"version": "8.1.32",
4+
"url": "https://www.php.net/distributions/php-8.1.32.tar.xz",
35
"ascUrl": "https://www.php.net/distributions/php-8.1.32.tar.xz.asc",
46
"sha256": "c582ac682a280bbc69bc2186c21eb7e3313cc73099be61a6bc1d2cd337cbf383",
5-
"url": "https://www.php.net/distributions/php-8.1.32.tar.xz",
67
"variants": [
78
"bookworm/cli",
89
"bookworm/apache",
@@ -18,14 +19,14 @@
1819
"alpine3.20/cli",
1920
"alpine3.20/fpm",
2021
"alpine3.20/zts"
21-
],
22-
"version": "8.1.32"
22+
]
2323
},
2424
"8.1-rc": null,
2525
"8.2": {
26+
"version": "8.2.28",
27+
"url": "https://www.php.net/distributions/php-8.2.28.tar.xz",
2628
"ascUrl": "https://www.php.net/distributions/php-8.2.28.tar.xz.asc",
2729
"sha256": "af8c9153153a7f489153b7a74f2f29a5ee36f5cb2c6c6929c98411a577e89c91",
28-
"url": "https://www.php.net/distributions/php-8.2.28.tar.xz",
2930
"variants": [
3031
"bookworm/cli",
3132
"bookworm/apache",
@@ -41,14 +42,14 @@
4142
"alpine3.20/cli",
4243
"alpine3.20/fpm",
4344
"alpine3.20/zts"
44-
],
45-
"version": "8.2.28"
45+
]
4646
},
4747
"8.2-rc": null,
4848
"8.3": {
49+
"version": "8.3.20",
50+
"url": "https://www.php.net/distributions/php-8.3.20.tar.xz",
4951
"ascUrl": "https://www.php.net/distributions/php-8.3.20.tar.xz.asc",
5052
"sha256": "f15914e071b5bddaf1475b5f2ba68107e8b8846655f9e89690fb7cd410b0db6c",
51-
"url": "https://www.php.net/distributions/php-8.3.20.tar.xz",
5253
"variants": [
5354
"bookworm/cli",
5455
"bookworm/apache",
@@ -64,13 +65,13 @@
6465
"alpine3.20/cli",
6566
"alpine3.20/fpm",
6667
"alpine3.20/zts"
67-
],
68-
"version": "8.3.20"
68+
]
6969
},
7070
"8.3-rc": {
71+
"version": "8.3.21RC1",
72+
"url": "https://downloads.php.net/~eric/php-8.3.21RC1.tar.xz",
7173
"ascUrl": "https://downloads.php.net/~eric/php-8.3.21RC1.tar.xz.asc",
7274
"sha256": "6d8bf25e0584cfcb83243fd7d1a90c06d428f1204eea93bb3c027c6e3344a23e",
73-
"url": "https://downloads.php.net/~eric/php-8.3.21RC1.tar.xz",
7475
"variants": [
7576
"bookworm/cli",
7677
"bookworm/apache",
@@ -86,13 +87,13 @@
8687
"alpine3.20/cli",
8788
"alpine3.20/fpm",
8889
"alpine3.20/zts"
89-
],
90-
"version": "8.3.21RC1"
90+
]
9191
},
9292
"8.4": {
93+
"version": "8.4.6",
94+
"url": "https://www.php.net/distributions/php-8.4.6.tar.xz",
9395
"ascUrl": "https://www.php.net/distributions/php-8.4.6.tar.xz.asc",
9496
"sha256": "089b08a5efef02313483325f3bacd8c4fe311cf1e1e56749d5cc7d059e225631",
95-
"url": "https://www.php.net/distributions/php-8.4.6.tar.xz",
9697
"variants": [
9798
"bookworm/cli",
9899
"bookworm/apache",
@@ -108,13 +109,13 @@
108109
"alpine3.20/cli",
109110
"alpine3.20/fpm",
110111
"alpine3.20/zts"
111-
],
112-
"version": "8.4.6"
112+
]
113113
},
114114
"8.4-rc": {
115+
"version": "8.4.7RC1",
116+
"url": "https://downloads.php.net/~saki/php-8.4.7RC1.tar.xz",
115117
"ascUrl": "https://downloads.php.net/~saki/php-8.4.7RC1.tar.xz.asc",
116118
"sha256": "6cb37632eb65ee311cb4427ad070b6ab27fdaf13e8f0103701b2b78907326c93",
117-
"url": "https://downloads.php.net/~saki/php-8.4.7RC1.tar.xz",
118119
"variants": [
119120
"bookworm/cli",
120121
"bookworm/apache",
@@ -130,7 +131,6 @@
130131
"alpine3.20/cli",
131132
"alpine3.20/fpm",
132133
"alpine3.20/zts"
133-
],
134-
"version": "8.4.7RC1"
134+
]
135135
}
136136
}

versions.sh

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ set -Eeuo pipefail
33

44
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
55

6+
# TODO consume https://www.php.net/releases/branches.php and https://www.php.net/release-candidates.php?format=json here like in Go, Julia, etc (so we can have a canonical "here's all the versions possible" mode, and more automated metadata like EOL 👀)
7+
68
versions=( "$@" )
79
if [ ${#versions[@]} -eq 0 ]; then
810
versions=( */ )
@@ -52,16 +54,9 @@ for version in "${versions[@]}"; do
5254
unset IFS
5355

5456
if [ "${#possibles[@]}" -eq 0 ]; then
55-
if [ "$rcVersion" = "$version" ]; then
56-
echo >&2
57-
echo >&2 "error: unable to determine available releases of $version"
58-
echo >&2
59-
exit 1
60-
else
61-
echo >&2 "warning: skipping/removing '$version' (does not appear to exist upstream)"
62-
json="$(jq <<<"$json" -c '.[env.version] = null')"
63-
continue
64-
fi
57+
echo >&2 "warning: skipping/removing '$version' (does not appear to exist upstream)"
58+
json="$(jq <<<"$json" -c '.[env.version] = null')"
59+
continue
6560
fi
6661

6762
# format of "possibles" array entries is "VERSION URL.TAR.XZ URL.TAR.XZ.ASC SHA256" (each value shell quoted)
@@ -116,11 +111,15 @@ for version in "${versions[@]}"; do
116111
'
117112
)"
118113

119-
if [ "$version" = "$rcVersion" ]; then
120-
json="$(jq <<<"$json" -c '
121-
.[env.version + "-rc"] //= null
122-
')"
123-
fi
114+
# make sure RCs and releases have corresponding pairs
115+
json="$(jq <<<"$json" -c '
116+
.[
117+
env.version
118+
+ if env.version == env.rcVersion then
119+
"-rc"
120+
else "" end
121+
] //= null
122+
')"
124123
done
125124

126-
jq <<<"$json" -S . > versions.json
125+
jq <<<"$json" 'to_entries | sort_by(.key) | from_entries' > versions.json

0 commit comments

Comments
 (0)