-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release-latest-versions.sh
executable file
·36 lines (27 loc) · 953 Bytes
/
release-latest-versions.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
#!/usr/bin/env bash
set -e
Do_release()
{
local VERSION="$1"
echo "Releasing ${VERSION} version ..."
if git rev-parse "refs/tags/v${VERSION}" >/dev/null 2>&1; then
echo "Tag exists!"
echo
return 0
fi
# Get new version
rm -r -f source/includes/
echo "${VERSION}" >VERSION
wget -q -O- "https://api.github.com/repos/WordPress/wordpress-develop/tarball/refs/tags/${VERSION}" \
| tar -x -z --directory=source/ --strip-components=3 --wildcards "*/tests/phpunit/includes/"
# Generate stubs
echo "Generating stubs ..."
./generate.sh
# Tag version
git commit --all -m "Generate stubs for WordPress Tests ${VERSION}" --allow-empty
git tag "v${VERSION}"
}
TESTS_JSON="$(wget -q -O- "https://api.github.com/repos/WordPress/wordpress-develop/tags?per_page=100")"
while read -r TAG; do
Do_release "${TAG}"
done < <(jq -r '[.[].name] | reverse[]' <<<"${TESTS_JSON}")