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."
|
err "Neither podman nor docker is installed."
|
||||||
fi
|
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
|
# Pre-flight checks
|
||||||
# ---------------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
echo "============================================"
|
echo "============================================"
|
||||||
echo " AniWorld — Build & Push"
|
echo " AniWorld — Build & Push"
|
||||||
echo " Engine : ${ENGINE}"
|
echo " Engine : ${ENGINE}"
|
||||||
|
|||||||
@@ -85,7 +85,20 @@ echo "Version file updated → ${VERSION_FILE}"
|
|||||||
FRONT_VERSION="${NEW_TAG#v}"
|
FRONT_VERSION="${NEW_TAG#v}"
|
||||||
FRONT_PKG="${SCRIPT_DIR}/../package.json"
|
FRONT_PKG="${SCRIPT_DIR}/../package.json"
|
||||||
if [[ -f "${FRONT_PKG}" ]]; then
|
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}"
|
echo "package.json version updated → ${FRONT_VERSION}"
|
||||||
else
|
else
|
||||||
echo "Warning: package.json not found, skipping package.json version sync" >&2
|
echo "Warning: package.json not found, skipping package.json version sync" >&2
|
||||||
@@ -94,13 +107,63 @@ fi
|
|||||||
# Keep root pyproject.toml in sync.
|
# Keep root pyproject.toml in sync.
|
||||||
BACKEND_PYPROJECT="${SCRIPT_DIR}/../pyproject.toml"
|
BACKEND_PYPROJECT="${SCRIPT_DIR}/../pyproject.toml"
|
||||||
if [[ -f "${BACKEND_PYPROJECT}" ]]; then
|
if [[ -f "${BACKEND_PYPROJECT}" ]]; then
|
||||||
# Update version under [project] section if present
|
# Use python instead of sed: the previous `sed -i` used double-quoted
|
||||||
if grep -q '^\[project\]' "${BACKEND_PYPROJECT}"; then
|
# patterns whose `&` and `\` characters would have to be escaped, and
|
||||||
sed -i "/^\[project\]/,/^\[/ s/^version = \".*\"/version = \"${FRONT_VERSION}\"/" "${BACKEND_PYPROJECT}"
|
# more importantly it could silently do nothing if the [project] section
|
||||||
else
|
# was missing. python reads/writes the file as a string, preserving
|
||||||
sed -i "s/^version = \".*\"/version = \"${FRONT_VERSION}\"/" "${BACKEND_PYPROJECT}"
|
# 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
|
fi
|
||||||
echo "pyproject.toml version updated → ${FRONT_VERSION}"
|
|
||||||
else
|
else
|
||||||
echo "Warning: pyproject.toml not found, skipping pyproject.toml version sync" >&2
|
echo "Warning: pyproject.toml not found, skipping pyproject.toml version sync" >&2
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "aniworld-web",
|
"name": "aniworld-web",
|
||||||
"version": "1.5.7",
|
"version": "1.5.9",
|
||||||
"description": "Aniworld Anime Download Manager - Web Frontend",
|
"description": "Aniworld Anime Download Manager - Web Frontend",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user