mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-10-12 23:08:31 +08:00
# Improvements - **ci(docker)**: add OCI labels and build metadata to Docker images - **Web UI**: Show an "Update available" badge next to the version and a toast notification when a newer version is detected - **Web UI**: Add integrated docs with collapsible sections - **ci(build)**: Publish to PyPI - **Category**: Allow category changes regardless of the "Category Update All" status (Fixes #913) # Bug Fixes - Fixes container hanging when using run command with QBT_RUN flag (Fixes #911) - Fixes bug on interval scheduler not displaying the correct next run time - Fix bug on webAPI requests not being queued correctly when called during a scheduled run **Full Changelog**: https://github.com/StuffAnThings/qbit_manage/compare/v4.5.4...v4.5.5 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Actionbot <actions@github.com> Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: ineednewpajamas <73252768+ineednewpajamas@users.noreply.github.com>
84 lines
3.2 KiB
Bash
Executable file
84 lines
3.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# Detect if running in CI (e.g., GitHub Actions or pre-commit.ci)
|
|
if [[ -n "$GITHUB_ACTIONS" || -n "$CI" || -n "$PRE_COMMIT_CI" ]]; then
|
|
IN_CI=true
|
|
else
|
|
IN_CI=false
|
|
fi
|
|
# CI: For pull_request events, check if the PR itself changes VERSION.
|
|
# If not, run the develop version updater. This avoids relying on staged files.
|
|
if [[ "$IN_CI" == "true" ]]; then
|
|
BASE_REF="${GITHUB_BASE_REF:-}"
|
|
|
|
# If BASE_REF not provided (e.g., pre-commit.ci), infer remote default branch
|
|
if [[ -z "$BASE_REF" ]]; then
|
|
DEFAULT_BASE="$(git symbolic-ref -q --short refs/remotes/origin/HEAD 2>/dev/null | sed 's#^origin/##')"
|
|
if [[ -z "$DEFAULT_BASE" ]]; then
|
|
DEFAULT_BASE="$(git remote show origin 2>/dev/null | sed -n 's/.*HEAD branch: //p' | head -n1)"
|
|
fi
|
|
BASE_REF="$DEFAULT_BASE"
|
|
fi
|
|
|
|
# Resolve a usable base ref
|
|
CANDIDATES=()
|
|
if [[ -n "$BASE_REF" ]]; then
|
|
CANDIDATES+=("refs/remotes/origin/$BASE_REF")
|
|
CANDIDATES+=("refs/heads/$BASE_REF")
|
|
fi
|
|
|
|
BASE_RESOLVED=""
|
|
for ref in "${CANDIDATES[@]}"; do
|
|
if git rev-parse --verify -q "$ref" >/dev/null; then
|
|
BASE_RESOLVED="$ref"
|
|
break
|
|
fi
|
|
done
|
|
|
|
# Attempt to fetch the remote-tracking base if missing (handles shallow clones)
|
|
if [[ -z "$BASE_RESOLVED" && -n "$BASE_REF" ]]; then
|
|
git fetch --no-tags --depth=100 origin "refs/heads/$BASE_REF:refs/remotes/origin/$BASE_REF" >/dev/null 2>&1 || true
|
|
if git rev-parse --verify -q "refs/remotes/origin/$BASE_REF" >/dev/null; then
|
|
BASE_RESOLVED="refs/remotes/origin/$BASE_REF"
|
|
elif git rev-parse --verify -q "refs/heads/$BASE_REF" >/dev/null; then
|
|
BASE_RESOLVED="refs/heads/$BASE_REF"
|
|
fi
|
|
fi
|
|
|
|
if [[ -z "$BASE_RESOLVED" ]]; then
|
|
echo "Warning: Could not resolve PR base ref for '$BASE_REF'."
|
|
echo "Hint: ensure the base ref is available (e.g., full fetch)."
|
|
echo "Skipping version update because PR base could not be resolved."
|
|
exit 0
|
|
fi
|
|
|
|
# If diff is quiet, there were no changes to VERSION between base and head.
|
|
if git diff --quiet "$BASE_RESOLVED...HEAD" -- VERSION; then
|
|
echo "No VERSION bump detected in PR range ($BASE_RESOLVED...HEAD). Updating develop version."
|
|
source "$(dirname "$0")/update_develop_version.sh"
|
|
else
|
|
echo "PR includes a VERSION change. Skipping version update."
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
# When running locally during an actual commit, skip if nothing is staged.
|
|
# In CI, pre-commit typically runs outside of a commit with no staged files,
|
|
# so we must not early-exit there.
|
|
if [[ "$IN_CI" != "true" && -z $(git diff --cached --name-only) ]]; then
|
|
echo "There are no changes staged for commit. Skipping version update."
|
|
exit 0
|
|
fi
|
|
|
|
# Check if the VERSION file is staged for modification
|
|
if git diff --cached --name-only | grep -q "VERSION"; then
|
|
echo "The VERSION file is already modified. Skipping version update."
|
|
exit 0
|
|
elif git diff --name-only | grep -q "VERSION"; then
|
|
echo "The VERSION file has unstaged changes. Please stage them before committing."
|
|
exit 0
|
|
elif ! git show --name-only HEAD | grep -q "VERSION"; then
|
|
source "$(dirname "$0")/update_develop_version.sh"
|
|
elif [[ -n "$(git diff --cached --name-only)" ]] && ! git diff --cached --name-only | grep -q "VERSION"; then
|
|
source "$(dirname "$0")/update_develop_version.sh"
|
|
fi
|