--- title: DrivePurge Release Automation emoji: 🗂️ colorFrom: blue colorTo: indigo sdk: docker app_port: 7860 pinned: false --- # DrivePurge Release Automation API FastAPI server that automates version tracking, release scanning, per-OS asset mirroring, and metadata JSON generation for the [DrivePurge_](https://github.com/Drive-Purge/DrivePurge_) GitHub repository. ## 🔧 Environment Variables (set in Space Secrets) | Variable | Required | Default | Description | |---|---|---|---| | `GITHUB_TOKEN` | ✅ | — | Fine-grained PAT: **Contents R/W**, **Metadata R** | | `REPO_OWNER` | | `Drive-Purge` | GitHub org / user | | `REPO_NAME` | | `DrivePurge_` | Repository name | | `OUTPUT_DIR` | | `/tmp/releases` | Where assets + JSONs are written | ## 🚀 Endpoints | Method | Path | Description | |---|---|---| | `GET` | `/health` | Ping | | `POST` | `/update-file` | Push any file to the repo | | `GET` | `/releases` | All releases with per-OS download URLs | | `GET` | `/releases/{tag}` | Single release detail + `by_os` breakdown | | `POST` | `/process-release/{tag}` | Download assets + write `release{ver}.json` | | `POST` | `/trigger` | **Full pipeline** | Swagger UI: `https://.hf.space/docs` ## 📦 Asset JSON Schema (per asset) ```json { "name": "DrivePurge-linux-amd64-v1.0.zip", "os": "linux", "arch": "x86_64", "size_bytes": 214202000, "download_url": "https://github.com/.../DrivePurge-linux-amd64-v1.0.zip", "content_type": "application/zip", "created_at": "2026-05-24T06:20:47Z", "local_path": "/tmp/releases/release1_0/DrivePurge-linux-amd64-v1.0.zip" } ``` ## 🗂️ Full Release JSON ```json { "repo": "Drive-Purge/DrivePurge_", "tag": "v1.0", "name": "DrivePurge v1.0", "body": "...", "published_at": "2026-05-24T06:24:00Z", "html_url": "https://github.com/...", "assets": [ ...all assets flat... ], "by_os": { "windows": [ ...exe + zip... ], "macos": [ ...arm zip... ], "linux": [ ...amd64 zip... ], "all": [ ...checksums.txt... ] }, "generated_at": "2026-05-24T07:00:00+00:00" } ``` ## 🖥️ OS / Arch Detection Rules | Filename pattern | `os` | `arch` | |---|---|---| | `*windows*amd64*`, `*.exe` | `windows` | `x86_64` | | `*windows*arm64*` | `windows` | `arm64` | | `*macos*arm64*`, `*darwin*arm64*` | `macos` | `arm64` | | `*macos*amd64*`, `*darwin*amd64*` | `macos` | `x86_64` | | `*macos*`, `*darwin*` | `macos` | `universal` | | `*linux*amd64*`, `*linux*x86_64*` | `linux` | `x86_64` | | `*linux*arm64*`, `*linux*aarch64*` | `linux` | `arm64` | | `*checksums*`, `*sha256*` | `all` | `all` | ## ▶️ Run Locally ```bash pip install -r requirements.txt export GITHUB_TOKEN="ghp_..." python main.py # listens on :7860 # or uvicorn main:app --reload --port 7860 ```