diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..1bde2fe --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release Binaries + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +jobs: + 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 + 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 }} diff --git a/README.md b/README.md index 113e32b..dcbee55 100644 --- a/README.md +++ b/README.md @@ -266,22 +266,24 @@ This tests invalid token rejection, encrypted socket streaming, database persist --- -## Publishing Releases (Direct Binary Upload to Gitea) +## Automated Releases via Gitea Actions -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): +Releases are automated via [`.gitea/workflows/release.yml`](.gitea/workflows/release.yml) using your Gitea action runner: -### One-Command Release Publishing +### Publishing a Release +Whenever you want to release a new version with compiled standalone binaries: ```bash -python upload_release.py --tag v1.0.0 --token +git tag v1.0.0 +git push origin v1.0.0 ``` -*(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. +### What Gitea Actions Does Automatically: +1. Gitea runner executes the workflow on tag push. +2. Runs `package_dist.py` to compile native standalone binaries: + - `Linux_Client.bin` (standalone binary) + - `Server.bin` (standalone server binary) + - `Win_Client.pyz` (standalone executable zipapp) + - `SHA256SUMS.txt` (checksums) +3. Publishes the Gitea release using `gitea-release-action` and attaches the compiled binary assets. + +*(Note: You can also use `upload_release.py` from your Windows machine to upload Windows `.exe` binaries directly if desired).* diff --git a/package_dist.py b/package_dist.py index 7104abc..e4dadae 100644 --- a/package_dist.py +++ b/package_dist.py @@ -94,6 +94,18 @@ def main(): server_script = os.path.join(OUT_DIR, "server", "Server.py") build_pyinstaller_binary(server_script, "Server.bin") + # Also package standalone Windows zipapp executable + win_app_dir = os.path.join(BUILD_TEMP, "win_app") + os.makedirs(win_app_dir, exist_ok=True) + shutil.copy(os.path.join(OUT_DIR, "win_client", "Win_Client.py"), os.path.join(win_app_dir, "Win_Client.py")) + win_bin_output = os.path.join(DIST_DIR, "Win_Client.pyz") + zipapp.create_archive( + source=win_app_dir, + target=win_bin_output, + interpreter="/usr/bin/env python3", + main="Win_Client:main" + ) + generate_checksums() # Clean temporary build directory