| --- |
| 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://<your-space>.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 |
| ``` |