Align release script, Gear Lever docs, and remote with the new host and repo name. Co-authored-by: Cursor <[email protected]>
75 lines
2.1 KiB
Bash
Executable File
75 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Push tag to Gitea and publish HSRename.AppImage as a release asset.
|
|
# Usage:
|
|
# GITEA_TOKEN=your_token ./release_gitea.sh
|
|
# Optional: ./release_gitea.sh --build (rebuild AppImage first)
|
|
#
|
|
# Requires: curl, git, and network access to your Gitea instance.
|
|
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
GITEA_HOST="${GITEA_HOST:-https://git.hisora.dev}"
|
|
GITEA_OWNER="${GITEA_OWNER:-Dawnsorrow}"
|
|
GITEA_REPO="${GITEA_REPO:-HS-Rename}"
|
|
APP_IMAGE="HSRename.AppImage"
|
|
|
|
VERSION="$(tr -d '[:space:]' < VERSION)"
|
|
TAG="v${VERSION}"
|
|
|
|
if [[ "${1:-}" == "--build" ]]; then
|
|
export PATH="/tmp:${PATH}"
|
|
if ! command -v appimagetool &>/dev/null && [[ -x /tmp/appimagetool ]]; then
|
|
export PATH="/tmp:${PATH}"
|
|
fi
|
|
./build_appimage.sh
|
|
fi
|
|
|
|
if [[ ! -f "$APP_IMAGE" ]]; then
|
|
echo "Missing $APP_IMAGE. Run ./build_appimage.sh or ./release_gitea.sh --build"
|
|
exit 1
|
|
fi
|
|
|
|
if ! git rev-parse "$TAG" >/dev/null 2>&1; then
|
|
echo "Tag $TAG not found. Create it with: git tag $TAG"
|
|
exit 1
|
|
fi
|
|
|
|
echo "=== Pushing main and tag $TAG ==="
|
|
git push origin main
|
|
git push origin "$TAG"
|
|
|
|
if [[ -z "${GITEA_TOKEN:-}" ]]; then
|
|
echo ""
|
|
echo "Code and tag pushed. To upload the AppImage, set GITEA_TOKEN and re-run:"
|
|
echo " GITEA_TOKEN=... ./release_gitea.sh"
|
|
echo ""
|
|
echo "Or create the release manually on Gitea and attach $APP_IMAGE."
|
|
exit 0
|
|
fi
|
|
|
|
API="${GITEA_HOST}/api/v1/repos/${GITEA_OWNER}/${GITEA_REPO}/releases"
|
|
NOTES="$(cat <<EOF
|
|
## HSRename ${TAG}
|
|
|
|
- TheTVDB episode title matching: fix SxxExx numbering against TheTVDB order (default, aired, DVD, etc.)
|
|
- Episode renumbering and multi-episode ranges unchanged
|
|
|
|
Gear Lever update URL:
|
|
\`${GITEA_HOST}/${GITEA_OWNER}/${GITEA_REPO}/releases/download/${TAG}/${APP_IMAGE}\`
|
|
EOF
|
|
)"
|
|
|
|
echo "=== Creating Gitea release $TAG ==="
|
|
curl -fsS -X POST "$API" \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-F "tag_name=${TAG}" \
|
|
-F "title=${TAG}" \
|
|
-F "body=${NOTES}" \
|
|
-F "attachment=@${APP_IMAGE};filename=${APP_IMAGE}"
|
|
|
|
echo ""
|
|
echo "Release published:"
|
|
echo " ${GITEA_HOST}/${GITEA_OWNER}/${GITEA_REPO}/releases/tag/${TAG}"
|
|
echo " ${GITEA_HOST}/${GITEA_OWNER}/${GITEA_REPO}/releases/download/${TAG}/${APP_IMAGE}"
|