Compare commits
4 Commits
0f872276dd
...
b8892b4737
| Author | SHA1 | Date | |
|---|---|---|---|
| b8892b4737 | |||
| 16977d6227 | |||
| 7538ea8608 | |||
| 7da7668787 |
@@ -1 +1 @@
|
||||
v1.5.7
|
||||
v1.5.9
|
||||
|
||||
@@ -59,9 +59,26 @@ else
|
||||
err "Neither podman nor docker is installed."
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# -------------------------------------------------------------------
|
||||
# Refuse to run from inside a confined snap sandbox (e.g. the VS Code
|
||||
# integrated terminal). When the script is launched from such a
|
||||
# sandbox, $HOME points under /home/$USER/snap/code/<rev>/ and podman
|
||||
# stores its DB under that path. If a snap revision bump happens mid
|
||||
# session, the next podman invocation finds a stale static-dir pointer
|
||||
# and aborts with a confusing "database static dir ... does not match"
|
||||
# error. Re-run the script from a regular host shell instead.
|
||||
# -------------------------------------------------------------------
|
||||
case "${HOME:-}" in
|
||||
/home/*/snap/*)
|
||||
err "Refusing to run inside a snap-sandboxed HOME (${HOME}). \
|
||||
Re-run from a regular host terminal (e.g. gnome-terminal, konsole) \
|
||||
so podman uses a stable storage path."
|
||||
;;
|
||||
esac
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Pre-flight checks
|
||||
# ---------------------------------------------------------------------------
|
||||
# -------------------------------------------------------------------
|
||||
echo "============================================"
|
||||
echo " AniWorld — Build & Push"
|
||||
echo " Engine : ${ENGINE}"
|
||||
|
||||
@@ -85,7 +85,20 @@ echo "Version file updated → ${VERSION_FILE}"
|
||||
FRONT_VERSION="${NEW_TAG#v}"
|
||||
FRONT_PKG="${SCRIPT_DIR}/../package.json"
|
||||
if [[ -f "${FRONT_PKG}" ]]; then
|
||||
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"${FRONT_VERSION}\"/" "${FRONT_PKG}"
|
||||
# Use a python one-liner for portable, safe JSON editing. The previous
|
||||
# `sed -i` used single-quoted bash strings, which prevented
|
||||
# ${FRONT_VERSION} from being interpolated and silently rewrote the file
|
||||
# to the literal string "${FRONT_VERSION}".
|
||||
python3 - "$FRONT_PKG" "$FRONT_VERSION" <<'PY'
|
||||
import json, sys
|
||||
path, new_version = sys.argv[1], sys.argv[2]
|
||||
with open(path, encoding="utf-8") as fh:
|
||||
data = json.load(fh)
|
||||
data["version"] = new_version
|
||||
with open(path, "w", encoding="utf-8") as fh:
|
||||
json.dump(data, fh, indent=2)
|
||||
fh.write("\n")
|
||||
PY
|
||||
echo "package.json version updated → ${FRONT_VERSION}"
|
||||
else
|
||||
echo "Warning: package.json not found, skipping package.json version sync" >&2
|
||||
@@ -94,13 +107,63 @@ fi
|
||||
# Keep root pyproject.toml in sync.
|
||||
BACKEND_PYPROJECT="${SCRIPT_DIR}/../pyproject.toml"
|
||||
if [[ -f "${BACKEND_PYPROJECT}" ]]; then
|
||||
# Update version under [project] section if present
|
||||
if grep -q '^\[project\]' "${BACKEND_PYPROJECT}"; then
|
||||
sed -i "/^\[project\]/,/^\[/ s/^version = \".*\"/version = \"${FRONT_VERSION}\"/" "${BACKEND_PYPROJECT}"
|
||||
else
|
||||
sed -i "s/^version = \".*\"/version = \"${FRONT_VERSION}\"/" "${BACKEND_PYPROJECT}"
|
||||
# Use python instead of sed: the previous `sed -i` used double-quoted
|
||||
# patterns whose `&` and `\` characters would have to be escaped, and
|
||||
# more importantly it could silently do nothing if the [project] section
|
||||
# was missing. python reads/writes the file as a string, preserving
|
||||
# the existing format, and reports whether anything changed.
|
||||
if FRONT_VERSION="$FRONT_VERSION" BACKEND_PYPROJECT="$BACKEND_PYPROJECT" python3 <<'PY'
|
||||
import os, re, sys
|
||||
|
||||
path = os.environ["BACKEND_PYPROJECT"]
|
||||
new_version = os.environ["FRONT_VERSION"]
|
||||
with open(path, encoding="utf-8") as fh:
|
||||
text = fh.read()
|
||||
|
||||
# If there is a [project] table, update only the `version = "..."` line
|
||||
# inside it; otherwise update the first top-level `version = "..."` line.
|
||||
project_match = re.search(r"^\[project\]\s*$", text, re.MULTILINE)
|
||||
if project_match:
|
||||
start = project_match.end()
|
||||
end = re.search(r"^\[", text[start:], re.MULTILINE)
|
||||
section_end = start + end.start() if end else len(text)
|
||||
section = text[start:section_end]
|
||||
new_section, n = re.subn(
|
||||
r'^version = ".*"$',
|
||||
f'version = "{new_version}"',
|
||||
section,
|
||||
count=1,
|
||||
flags=re.MULTILINE,
|
||||
)
|
||||
if n == 0:
|
||||
print(
|
||||
f"Warning: no `version = ...` line found under [project] in {path}",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(2)
|
||||
text = text[:start] + new_section + text[section_end:]
|
||||
else:
|
||||
new_text, n = re.subn(
|
||||
r'^version = ".*"$',
|
||||
f'version = "{new_version}"',
|
||||
text,
|
||||
count=1,
|
||||
flags=re.MULTILINE,
|
||||
)
|
||||
if n == 0:
|
||||
print(
|
||||
f"Warning: no `version = ...` line found in {path}",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(2)
|
||||
text = new_text
|
||||
|
||||
with open(path, "w", encoding="utf-8") as fh:
|
||||
fh.write(text)
|
||||
PY
|
||||
then
|
||||
echo "pyproject.toml version updated → ${FRONT_VERSION}"
|
||||
fi
|
||||
echo "pyproject.toml version updated → ${FRONT_VERSION}"
|
||||
else
|
||||
echo "Warning: pyproject.toml not found, skipping pyproject.toml version sync" >&2
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "aniworld-web",
|
||||
"version": "1.5.7",
|
||||
"version": "1.5.9",
|
||||
"description": "Aniworld Anime Download Manager - Web Frontend",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user