Skip to content

Add a script to populate the array of available versions (per project) #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ if [ "$PROJECT" == "orm" ] || [ "$PROJECT" == "reactive" ] || [ "$PROJECT" == "m
--no-scan --no-daemon --no-build-cache --stacktrace $EXTRA_ARGS \
-PreleaseVersion=$RELEASE_VERSION -PdevelopmentVersion=$DEVELOPMENT_VERSION \
-PdocPublishBranch=production -PgitRemote=origin -PgitBranch=$BRANCH

if [ "$PROJECT" == "orm" ] || [ "$PROJECT" == "reactive" ]; then
exec_or_dry_run bash -xe "$SCRIPTS_DIR/update-available-versions-json.sh" "$PROJECT" "$RELEASE_VERSION_FAMILY"
fi
else
EXTRA_ARGS=""
if [ "$USE_JRELEASER_RELEASE" == "true" ]; then
Expand All @@ -213,6 +217,7 @@ else
if [[ "$PROJECT" != "tools" && "$PROJECT" != "hcann" && ! $PROJECT =~ ^infra-.+ ]]; then
exec_or_dry_run bash -xe "$SCRIPTS_DIR/upload-distribution.sh" "$PROJECT" "$RELEASE_VERSION"
exec_or_dry_run bash -xe "$SCRIPTS_DIR/upload-documentation.sh" "$PROJECT" "$RELEASE_VERSION" "$RELEASE_VERSION_FAMILY"
exec_or_dry_run bash -xe "$SCRIPTS_DIR/update-available-versions-json.sh" "$PROJECT" "$RELEASE_VERSION_FAMILY"
fi

bash -xe "$SCRIPTS_DIR/update-version.sh" "$PROJECT" "$DEVELOPMENT_VERSION"
Expand Down
39 changes: 39 additions & 0 deletions update-available-versions-json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env -S bash -e

PROJECT=$1
VERSION_FAMILY=$2
WORKSPACE=${WORKSPACE:-'.'}

if [ -z "$PROJECT" ]; then
echo "ERROR: Project not supplied"
exit 1
fi
if [ -z "$VERSION_FAMILY" ]; then
echo "ERROR: Version family argument not supplied"
exit 1
fi

pushd ${WORKSPACE}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this points to a directory that git-ignores available-*.json?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just blindly copypasted the upload-documentation.sh where the outadeted json is updated 🙈


wget -q http://docs.jboss.org/hibernate/_available-versions/${PROJECT}.json -O "available-${PROJECT}.json"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wget -q http://docs.jboss.org/hibernate/_available-versions/${PROJECT}.json -O "available-${PROJECT}.json"
wget -q http://docs.jboss.org/hibernate/_data/${PROJECT}/releases.json -O "releases.json"

? 🙈

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or /series.json, I guess?

Copy link
Member

@yrodiere yrodiere Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That being said, we can probably expose this -- and much more -- at hibernate.org/_data/${PROJECT}.json. Like, much, much more. Series, releases, links to docs -- you name it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rigth ... if we go with hibernate.org there'd be some cors update required I assume 😃
and if it's hibernate.org you mean it'll be a part of the ruby website build, right ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that's what I meant.
Yes we'd need cors updates, but I think it's defined in HTML headers, which we'd have modify anyway... no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, we just don't do it yet as for now all files come from the same server. but adding that cors in shouldn't be a problem, just need to keep in mind that orm is doing it not with these scripts 😃
I'll take a look at adding it to hibernate.org later today (or this week)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No rush, Marko. Maybe let's talk again before you do that? I'm sure you have plenty on your hands already :)

if [ ! -s ${PROJECT}.json ]; then
echo "Error downloading the ${PROJECT}.json descriptor. Exiting."
exit 1
fi

if jq -e "contains([\"$VERSION_FAMILY\"])" "available-${PROJECT}.json" >/dev/null; then
echo "Version '$VERSION_FAMILY' already exists."
else
echo "Version '$VERSION_FAMILY' not found. Adding..."

if jq ". + [\"$VERSION_FAMILY\"]" "available-${PROJECT}.json" > "available-${PROJECT}-updated.json"; then
echo "Uploading updated file..."
rsync -z --progress "available-${PROJECT}-updated.json" "filemgmt-prod-sync.jboss.org:/docs_htdocs/hibernate/_available-versions/${PROJECT}.json"
rm -f "available-${PROJECT}-updated.json"
else
echo "Error: Failed to add available version '$VERSION_FAMILY'..."
exit 1
fi
fi

popd