Replace runner workflow with direct binary release publisher via Gitea API

This commit is contained in:
2026-09-03 21:39:23 +02:00
parent 52fd645f17
commit 5974811c29
3 changed files with 27 additions and 52 deletions
-36
View File
@@ -1,36 +0,0 @@
name: Release Binaries
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Build Dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller -r requirements.txt
- name: Compile Standalone Binaries
run: |
python package_dist.py
- name: Publish Release (Binaries Only)
uses: https://gitea.com/actions/gitea-release-action@v1
with:
files: |
dist/*
api_key: ${{ secrets.TAG_TOKEN || github.token }}
token: ${{ secrets.TAG_TOKEN || github.token }}
+15 -11
View File
@@ -266,18 +266,22 @@ This tests invalid token rejection, encrypted socket streaming, database persist
---
## Automated Releases via Gitea Actions
## Publishing Releases (Direct Binary Upload to Gitea)
The repository includes a automated Gitea workflow at [`.gitea/workflows/release.yml`](.gitea/workflows/release.yml) and a local packaging utility [`package_dist.py`](package_dist.py).
Since Gitea does not have active action runners, you can compile and upload releases directly from your workstation using [`upload_release.py`](upload_release.py):
### How to Trigger a Release
1. Ensure your Gitea repository has `TAG_TOKEN` configured under **Repository Settings $\rightarrow$ Actions $\rightarrow$ Secrets**.
2. Tag a release version and push it:
### One-Command Release Publishing
```bash
git tag v1.0.0
git push origin v1.0.0
python upload_release.py --tag v1.0.0 --token <YOUR_GITEA_TOKEN>
```
3. Gitea Actions will automatically:
- Run `package_dist.py` to package server, Windows client, and Linux client into `dist/`.
- Compute SHA-256 checksums (`SHA256SUMS.txt`).
- Use `gitea-release-action` to publish the release with all attachments.
*(Or set `set GITEA_TOKEN=...` in your terminal and simply run `python upload_release.py --tag v1.0.0`)*
### What It Does:
1. Calls `package_dist.py` to compile native binaries:
- `Win_Client.exe`
- `Server.exe`
- `Linux_Client.bin`
- `SHA256SUMS.txt`
2. Connects to `https://gitea.eibl.tech/api/v1/repos/me0nline/LOGAR`.
3. Creates the Gitea release for `v1.0.0` (or updates an existing release).
4. Uploads only the compiled binary assets as downloadable attachments.
+10 -3
View File
@@ -68,12 +68,19 @@ def create_or_get_release(base_url, repo, tag, token, title=None, notes=None):
def main():
parser = argparse.ArgumentParser(description="Upload LOGAR compiled binaries directly to Gitea Release")
parser.add_argument("--tag", required=True, help="Release tag name (e.g. v1.0.0)")
parser.add_argument("--token", required=True, help="Gitea Personal Access Token")
parser.add_argument("--token", default=os.environ.get("GITEA_TOKEN"), help="Gitea Personal Access Token (or set GITEA_TOKEN env var)")
parser.add_argument("--url", default=DEFAULT_GITEA_URL, help="Base Gitea instance URL")
parser.add_argument("--repo", default=DEFAULT_REPO, help="Repository owner/name")
parser.add_argument("--skip-build", action="store_true", help="Skip running package_dist.py before upload")
args = parser.parse_args()
token = args.token
if not token:
token = input("Enter Gitea Personal Access Token: ").strip()
if not token:
print("[!] Token is required.")
sys.exit(1)
if not args.skip_build:
print("[*] Assembling compiled binaries...")
package_dist.main()
@@ -84,13 +91,13 @@ def main():
sys.exit(1)
print(f"[*] Connecting to Gitea: {args.url} (repo: {args.repo})...")
release_id = create_or_get_release(args.url, args.repo, args.tag, args.token)
release_id = create_or_get_release(args.url, args.repo, args.tag, token)
print(f"[*] Uploading binary assets from '{dist_dir}'...")
for f in sorted(os.listdir(dist_dir)):
fpath = os.path.join(dist_dir, f)
if os.path.isfile(fpath):
upload_file_to_release(args.url, args.repo, release_id, args.token, fpath)
upload_file_to_release(args.url, args.repo, release_id, token, fpath)
print(f"\n[+] Release successfully published with binary assets: {args.url}/{args.repo}/releases/tag/{args.tag}")