Skip prereleases of readable.css in the CI workflow (#21)
Until now the algorithm would assume that the latest release on Codeberg is always a final release. There is the very real possibility of prereleases, which we've learned today, but we can easily use jq to filter these out. This relates to #19 and fixes #20.
This commit is contained in:
parent
f25e4d2ec8
commit
affe4cced4
|
@ -4,15 +4,22 @@ set -o pipefail
|
||||||
set -o nounset
|
set -o nounset
|
||||||
|
|
||||||
# Query the codeberg.org API (see
|
# Query the codeberg.org API (see
|
||||||
# https://codeberg.org/api/swagger#/repository/repoListReleases) and use jq to
|
# https://codeberg.org/api/swagger#/repository/repoListReleases
|
||||||
# get the tag name of the latest release (i.e. the first element of the array
|
# ) and use jq to get the tag name of the
|
||||||
# in the JSON output). Finally, use sed to remove the double quotes around the
|
# latest release (i.e. the first element of the
|
||||||
# value.
|
# array in the JSON output, that is not a
|
||||||
|
# prerelease).
|
||||||
|
# The '-r' option will give us "raw" output,
|
||||||
|
# i.e. without surrounding double-quotes.
|
||||||
|
# We use 'map' and 'select' in combination,
|
||||||
|
# because jq won't return a list otherwise.
|
||||||
|
# Only using 'select' returns just the matching
|
||||||
|
# elements, which is not a valid json that we
|
||||||
|
# can process further.
|
||||||
TAG_VERSION=$(curl -s \
|
TAG_VERSION=$(curl -s \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
https://codeberg.org/api/v1/repos/Freedom-to-Write/readable.css/releases \
|
https://codeberg.org/api/v1/repos/Freedom-to-Write/readable.css/releases \
|
||||||
| jq '.[0].tag_name' \
|
| jq -r '.|map(select(.prerelease==false))[0].tag_name')
|
||||||
| sed 's/"//g')
|
|
||||||
|
|
||||||
echo "Latest tag: ${TAG_VERSION}"
|
echo "Latest tag: ${TAG_VERSION}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue