docs: pick the Forgejo release from experimental (#542)

in the case of a release that is not yet published, it will exist as
release candidates in the experimental organization. Every release go
through there and it is a reliable source.

Reviewed-on: https://codeberg.org/forgejo/docs/pulls/542
Reviewed-by: crystal <crystal@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2024-04-20 08:39:14 +00:00 committed by Earl Warren
parent bd8e4e588a
commit 4ce64e2840
2 changed files with 145 additions and 138 deletions

View file

@ -2,7 +2,7 @@
set -e
: ${FORGEJO:=/tmp/forgejo}
: ${FORGEJO:=/tmp/forgejo-binary}
function dependencies() {
if ! which jq curl > /dev/null ; then
@ -15,20 +15,21 @@ function latest() {
local major="$1"
if test "$major" = "next" ; then
curl -sS https://codeberg.org/api/v1/repos/forgejo/forgejo/releases | jq -r '.[] | .tag_name' | sort -r | head -1
select="" # this will pick whatever is the highest numbered release
else
curl -sS https://codeberg.org/api/v1/repos/forgejo/forgejo/releases | jq -r '.[] | .tag_name | select(startswith("'$major'"))' | sort -r | head -1
select="$major"
fi
curl -sS https://codeberg.org/api/v1/repos/forgejo-experimental/forgejo/releases | jq -r '.[] | .tag_name | select(startswith("'$select'"))' | sort --reverse --version-sort | head -1
}
function download() {
local major="$1"
if test -f /tmp/forgejo ; then
if test -f $FORGEJO ; then
return
fi
local version=$(latest $major)
curl -sS "https://codeberg.org/forgejo/forgejo/releases/download/${version}/forgejo-${version#v}-linux-amd64" > ${FORGEJO}
curl -sS "https://codeberg.org/forgejo-experimental/forgejo/releases/download/${version}/forgejo-${version#v}-linux-amd64" > ${FORGEJO}
chmod +x ${FORGEJO}
}
@ -155,7 +156,8 @@ function generate() {
function cleanup() {
sed \
-e 's/forgejo-dump-.*.zip/forgejo-dump-<timestamp>.zip/' \
-e '/^ *actions *$/d'
-e '/^ *actions *$/d' \
-e 's/ *$//'
}
function run() {