3v324v23 commited on
Commit
67fe7e8
·
1 Parent(s): 45b54a8

chore: establish standalone Mathly repository

Browse files
Files changed (1) hide show
  1. scripts/deploy_mathly.sh +0 -27
scripts/deploy_mathly.sh DELETED
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Deploys the current commit to the mathly Space (the math app) under its own name.
3
- # A Space takes its name and emoji from the front matter of README.md, which ihki and mathly share; this pushes a
4
- # copy of HEAD whose front matter says mathly, so the local README and the Arabic Space (origin) stay as they are.
5
- # Usage: scripts/deploy_mathly.sh (commit first; the remote `mathly` is https://huggingface.co/spaces/wzender/mathly)
6
- set -euo pipefail
7
- cd "$(git rev-parse --show-toplevel)"
8
- if [ -n "$(git status --porcelain)" ]; then
9
- echo "There are uncommitted changes. Commit them first: only committed work is deployed." >&2
10
- exit 1
11
- fi
12
- tmp=$(mktemp -d)
13
- trap 'git worktree remove --force "$tmp" >/dev/null 2>&1 || true; rm -rf "$tmp"' EXIT
14
- git worktree add --detach "$tmp" HEAD >/dev/null
15
- python3 - "$tmp/README.md" <<'PY'
16
- import re, sys
17
- path = sys.argv[1]
18
- text = open(path, encoding="utf-8").read()
19
- head, sep, rest = text.partition("\n---\n") # the front matter: between the first two --- lines
20
- own = {"title": "mathly", "emoji": "➗", "colorFrom": "blue", "colorTo": "gray"}
21
- for key, value in own.items():
22
- head = re.sub(rf"^{key}:.*$", f"{key}: {value}", head, flags=re.M)
23
- open(path, "w", encoding="utf-8").write(head + sep + rest)
24
- PY
25
- git -C "$tmp" commit -qam "mathly: the Space's own name"
26
- git -C "$tmp" push --force mathly HEAD:main
27
- echo "Pushed $(git rev-parse --short HEAD) to mathly. The build: https://huggingface.co/spaces/wzender/mathly?logs=build"