Spaces:
Paused
Paused
Download scripts/release.sh from stremio-db/a: direct link, hf CLI and curl.
- Browser
- Download file 1.83 kB
-
https://huggingface.co/spaces/stremio-db/a/resolve/main/scripts/release.sh
- Command line
-
hf download hf://spaces/stremio-db/a/scripts/release.sh
-
curl -L -o release.sh https://huggingface.co/spaces/stremio-db/a/resolve/main/scripts/release.sh
1.83 kB
| set -euo pipefail | |
| case "${1:-}" in | |
| repair) | |
| TAG=$(gh release list --limit 1 --json tagName --jq '.[0].tagName') | |
| echo "Re-triggering release for $TAG..." | |
| gh release delete "$TAG" --yes | |
| git tag -f "$TAG" | |
| git push origin "$TAG" --force | |
| gh release create "$TAG" --generate-notes | |
| echo "Re-created release $TAG" | |
| exit 0 | |
| ;; | |
| ""|--help|-h) | |
| echo "Usage: $0 <version> Create a new release" >&2 | |
| echo " $0 repair Re-trigger the last release workflow" >&2 | |
| echo "Example: $0 1.0.0" >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| VERSION="${1#v}" | |
| TAG="v$VERSION" | |
| # Ensure working tree is clean | |
| if ! git diff --quiet || ! git diff --cached --quiet; then | |
| echo "Error: working tree is not clean. Commit or stash changes first." >&2 | |
| exit 1 | |
| fi | |
| REPO_ROOT="$(git rev-parse --show-toplevel)" | |
| # Update Cargo.toml version — rewrite the first `version = "..."` line (the | |
| # [package] version; dependency versions are inline and don't start a line). | |
| # Uses awk for portability: BSD/macOS sed rejects `sed -i` without a suffix and | |
| # the GNU-only `0,/re/` address form. | |
| cargo_toml="$REPO_ROOT/api/Cargo.toml" | |
| tmp="$(mktemp)" | |
| awk -v ver="$VERSION" ' | |
| !done && /^version = "/ { sub(/"[^"]*"/, "\"" ver "\""); done = 1 } | |
| { print } | |
| ' "$cargo_toml" > "$tmp" && mv "$tmp" "$cargo_toml" | |
| # Update Cargo.lock | |
| (cd "$REPO_ROOT/api" && cargo update --workspace) | |
| # Update package.json version | |
| cd "$REPO_ROOT/web" && npm version "$VERSION" --no-git-tag-version | |
| cd "$REPO_ROOT" | |
| git add "$REPO_ROOT/api/Cargo.toml" "$REPO_ROOT/api/Cargo.lock" "$REPO_ROOT/web/package.json" "$REPO_ROOT/web/package-lock.json" | |
| git commit -m "release: $TAG" | |
| git push origin main | |
| gh release create "$TAG" --generate-notes | |
| echo "Released $TAG" | |