From 3165effa8a680d90aa42c40d70299ba195fd48f1 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sat, 14 Mar 2026 16:42:09 -0400 Subject: [PATCH] feat(packaging): add .deb and .dmg build scripts and integrate into CI/CD --- .github/workflows/binaries.yml | 28 +++++++++++++++++++++- RELEASE.md | 24 +++++++++++++++---- packaging/build_deb.sh | 44 ++++++++++++++++++++++++++++++++++ packaging/build_dmg.sh | 38 +++++++++++++++++++++++++++++ packaging/deb/DEBIAN/control | 9 +++++++ 5 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 packaging/build_deb.sh create mode 100644 packaging/build_dmg.sh create mode 100644 packaging/deb/DEBIAN/control diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index a034580..1cf1db5 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -51,8 +51,34 @@ jobs: --name "${{ matrix.artifact_name }}" \ voxvera/cli.py + - name: Build .deb (Linux) + if: matrix.os == 'ubuntu-latest' + run: | + chmod +x packaging/build_deb.sh + ./packaging/build_deb.sh dist/${{ matrix.artifact_name }} + + - name: Build .dmg (macOS) + if: matrix.os == 'macos-latest' + run: | + chmod +x packaging/build_dmg.sh + ./packaging/build_dmg.sh dist/${{ matrix.artifact_name }} + - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: ${{ matrix.asset_name }} - path: dist/${{ matrix.artifact_name }} + path: | + dist/${{ matrix.artifact_name }} + voxvera/resources/bin/*.deb + voxvera/resources/bin/*.dmg + + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + dist/${{ matrix.artifact_name }} + voxvera/resources/bin/*.deb + voxvera/resources/bin/*.dmg + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/RELEASE.md b/RELEASE.md index 900cb98..8bf1205 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -60,6 +60,18 @@ Generates a standalone `.flatpak` bundle. Requires `flatpak-builder`. ./packaging/build_flatpak.sh ``` +### Debian Package (Linux) +Generates a `.deb` package for Debian/Ubuntu systems. +```bash +./packaging/build_deb.sh +``` + +### DMG (macOS) +Generates a `.dmg` installer for macOS (must be run on macOS). +```bash +./packaging/build_dmg.sh +``` + ## 4. Release Execution 1. **Version Bump:** Update `__version__` in `voxvera/__init__.py` and `version` in `pyproject.toml`. @@ -70,8 +82,10 @@ Generates a standalone `.flatpak` bundle. Requires `flatpak-builder`. git tag -a vX.Y.Z -m "VoxVera vX.Y.Z" git push origin main --tags ``` -3. **GitHub Release:** - Create a release and upload the assets from `voxvera/resources/bin/` and `site/download/`. - ```bash - gh release create vX.Y.Z voxvera/resources/bin/* site/download/*.zip --title "VoxVera vX.Y.Z" --notes "Release notes here..." - ``` +## 5. Automated Releases (GitHub Actions) + +The repository is configured with a **Build Standalone Binaries** workflow that automatically runs when a new tag (`v*`) is pushed. This workflow: +- Builds native executables for **Linux**, **Windows (.exe)**, and **macOS**. +- Automatically attaches these binaries to the corresponding GitHub Release. + +This ensures that Windows users receive a professional `voxvera-windows.exe` rather than having to rely on `.bat` or `.sh` scripts. diff --git a/packaging/build_deb.sh b/packaging/build_deb.sh new file mode 100644 index 0000000..2cd6d43 --- /dev/null +++ b/packaging/build_deb.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -e + +# Ensure we are in project root +cd "$(dirname "$0")/.." + +ARCH=$(uname -m) +# Debian uses amd64 instead of x86_64 +if [ "$ARCH" == "x86_64" ]; then + DEB_ARCH="amd64" +elif [ "$ARCH" == "aarch64" ] || [ "$ARCH" == "arm64" ]; then + DEB_ARCH="arm64" +else + DEB_ARCH="$ARCH" +fi +BINARY=${1:-"voxvera/resources/bin/voxvera-linux-$ARCH"} + +if [ ! -f "$BINARY" ]; then + echo "Binary not found: $BINARY." >&2 + exit 1 +fi + + +VERSION=$(grep "__version__" voxvera/__init__.py | cut -d '"' -f 2) +PKG_DIR="build/voxvera_${VERSION}_${DEB_ARCH}" + +echo "Building .deb package for version $VERSION ($DEB_ARCH)..." + +rm -rf "$PKG_DIR" +mkdir -p "$PKG_DIR/usr/bin" +mkdir -p "$PKG_DIR/DEBIAN" + +cp "$BINARY" "$PKG_DIR/usr/bin/voxvera" +chmod +x "$PKG_DIR/usr/bin/voxvera" + +# Copy control file and update version/arch +cp packaging/deb/DEBIAN/control "$PKG_DIR/DEBIAN/control" +sed -i "s/^Version: .*/Version: $VERSION/" "$PKG_DIR/DEBIAN/control" +sed -i "s/^Architecture: .*/Architecture: $DEB_ARCH/" "$PKG_DIR/DEBIAN/control" + +# Build the package +dpkg-deb --build "$PKG_DIR" "voxvera/resources/bin/voxvera_${VERSION}_${DEB_ARCH}.deb" + +echo "Debian package created at voxvera/resources/bin/voxvera_${VERSION}_${DEB_ARCH}.deb" diff --git a/packaging/build_dmg.sh b/packaging/build_dmg.sh new file mode 100644 index 0000000..e319025 --- /dev/null +++ b/packaging/build_dmg.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -e + +# Ensure we are in project root +cd "$(dirname "$0")/.." + +# This script is intended to be run on macOS +if [ "$(uname)" != "Darwin" ]; then + echo "Error: .dmg creation requires macOS." >&2 + exit 1 +fi + +ARCH=$(uname -m) +BINARY=${1:-"voxvera/resources/bin/voxvera-macos-$ARCH"} + +if [ ! -f "$BINARY" ]; then + echo "Binary not found: $BINARY." >&2 + exit 1 +fi + +VERSION=$(grep "__version__" voxvera/__init__.py | cut -d '"' -f 2) +DMG_NAME="VoxVera_${VERSION}_${ARCH}.dmg" +STAGING_DIR="build/dmg_staging" + +echo "Building .dmg package for version $VERSION ($ARCH)..." + +rm -rf "$STAGING_DIR" +mkdir -p "$STAGING_DIR" + +# For a CLI tool, we just put the binary in the DMG. +# In the future, we could create an .app bundle if there's a GUI. +cp "$BINARY" "$STAGING_DIR/voxvera" +chmod +x "$STAGING_DIR/voxvera" + +# Create the DMG +hdiutil create -volname "VoxVera $VERSION" -srcfolder "$STAGING_DIR" -ov -format UDZO "voxvera/resources/bin/$DMG_NAME" + +echo "DMG created at voxvera/resources/bin/$DMG_NAME" diff --git a/packaging/deb/DEBIAN/control b/packaging/deb/DEBIAN/control new file mode 100644 index 0000000..f0cda7c --- /dev/null +++ b/packaging/deb/DEBIAN/control @@ -0,0 +1,9 @@ +Package: voxvera +Version: 0.1.4 +Section: utils +Priority: optional +Architecture: amd64 +Maintainer: VoxVera +Description: VoxVera CLI utilities + Anonymous message-spreading and flyer-generation tool. +Depends: libc6