Files
claude-code add607cc3d
werkator build succeeded after 02:41
werkator/publish build succeeded after 00:19
werkator/mutation build succeeded after 00:33
The version and the changelog follow from the PR documents (#70)
Co-authored-by: claude-code <claude-code@javagil.de>
2026-10-14 21:19:06 +02:00

25 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Publishes the current version to the Gitea Maven registry, unless it is there already.
# Run by the Werkator build "publish" after a green main build; needs GITEA_PACKAGES_TOKEN.
# A version is uploaded once: Gitea refuses a second upload, and a re-run of the same main
# commit must not turn red because of that.
set -euo pipefail
: "${GITEA_PACKAGES_TOKEN:?GITEA_PACKAGES_TOKEN is not set}"
cd "$(dirname "$0")/.."
# the build derives the version from the PR documents (docs/agentic-workflow.md, "Versions")
version="$(./gradlew --console=plain --no-daemon -q properties | sed -n 's/^version: //p')"
[ -n "$version" ] || { echo "the build gives no version" >&2; exit 1; }
pom="https://git.javagil.de/api/packages/mi/maven/de/javagil/werkcrappit/werkcrappit-pit/$version/werkcrappit-pit-$version.pom"
status="$(curl -s -o /dev/null -w '%{http_code}' -H "Authorization: token $GITEA_PACKAGES_TOKEN" "$pom")"
case "$status" in
200) echo "werkcrappit $version is already published, nothing to do"; exit 0 ;;
404) ;;
*) echo "cannot tell whether $version is published: HTTP $status for $pom" >&2; exit 1 ;;
esac
./gradlew --console=plain --no-daemon publishAllPublicationsToGiteaRepository
echo "published werkcrappit $version"