File size: 2,872 Bytes
c9e86bf 8ce59e3 c9e86bf 8ce59e3 c9e86bf 8ce59e3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | ---
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
``` |