diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..aecc090 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,105 @@ +name: Release + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + name: Build - ${{ matrix.target }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + cross: false + + - target: x86_64-unknown-linux-musl + os: ubuntu-latest + cross: true + + - target: aarch64-unknown-linux-gnu + os: ubuntu-latest + cross: true + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Install dependencies (Ubuntu) + if: matrix.os == 'ubuntu-latest' && !matrix.cross + run: | + sudo apt update + sudo apt install -y libglib2.0-dev libpolkit-gobject-1-dev libpolkit-agent-1-dev + + - name: Install cross + if: matrix.cross + run: | + cargo install cross --git https://github.com/cross-rs/cross + + - name: Build with cargo + if: "!matrix.cross" + run: cargo build --release --target ${{ matrix.target }} + + - name: Build with cross + if: matrix.cross + run: cross build --release --target ${{ matrix.target }} + + - name: Strip binary + run: | + strip target/${{ matrix.target }}/release/polkit-agent || true + + - name: Create tarball + run: | + cd target/${{ matrix.target }}/release + tar czf polly-${{ github.ref_name }}-${{ matrix.target }}.tar.gz polkit-agent + mv polly-${{ github.ref_name }}-${{ matrix.target }}.tar.gz ${{ github.workspace }}/ + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: polly-${{ matrix.target }} + path: polly-${{ github.ref_name }}-${{ matrix.target }}.tar.gz + + release: + name: Create Release + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Prepare release assets + run: | + mkdir release-assets + find artifacts -type f -name '*.tar.gz' -exec cp {} release-assets/ \; + ls -lah release-assets/ + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: release-assets/* + draft: false + prerelease: false + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index ea8c4bf..e36e4f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,18 @@ /target + +# AUR build artifacts +*.tar.gz +*.pkg.tar.zst +pkg/ +src/ + +# Editor files +*.swp +*.swo +*~ +.vscode/ +.idea/ + +# OS files +.DS_Store +Thumbs.db diff --git a/AUR_INSTALL.md b/AUR_INSTALL.md new file mode 100644 index 0000000..9242b08 --- /dev/null +++ b/AUR_INSTALL.md @@ -0,0 +1,127 @@ +# AUR Installation Guide + +This document provides instructions for installing polly from the Arch User Repository (AUR). + +## Available Packages + +### polly +The stable release version of polly, tracking tagged releases. + +```bash +# Using an AUR helper (e.g., yay, paru) +yay -S polly + +# Or manually +git clone https://aur.archlinux.org/polly.git +cd polly +makepkg -si +``` + +### polly-git +The development version of polly, tracking the latest git commits. + +```bash +# Using an AUR helper (e.g., yay, paru) +yay -S polly-git + +# Or manually +git clone https://aur.archlinux.org/polly-git.git +cd polly-git +makepkg -si +``` + +## Manual Installation from PKGBUILD + +If you want to build directly from this repository: + +```bash +# For stable version +makepkg -p PKGBUILD-polly -si + +# For git version +makepkg -p PKGBUILD-polly-git -si +``` + +## Dependencies + +### Runtime Dependencies +- glib2 +- polkit + +### Build Dependencies +- rust +- cargo +- git (for polly-git) + +## Running polly + +After installation, you can run polly as your Polkit authentication agent. + +### Option 1: Using systemd (recommended) + +Enable and start the systemd user service: + +```bash +systemctl --user enable --now polly.service +``` + +To disable autostart: +```bash +systemctl --user disable --now polly.service +``` + +### Option 2: Manual autostart + +Add the following to your compositor's autostart configuration: + +```bash +polly & +``` + +**Hyprland** (`~/.config/hypr/hyprland.conf`): +``` +exec-once = polly +``` + +**Sway** (`~/.config/sway/config`): +``` +exec polly +``` + +**River** (`~/.config/river/init`): +``` +polly & +``` + +## Submitting to AUR + +For maintainers wanting to submit these packages to AUR: + +1. Create the AUR repository: +```bash +# For stable version +git clone ssh://aur@aur.archlinux.org/polly.git +cd polly +cp /path/to/polkit-agent/PKGBUILD-polly PKGBUILD + +# Generate .SRCINFO +makepkg --printsrcinfo > .SRCINFO + +# Commit and push +git add PKGBUILD .SRCINFO +git commit -m "Initial commit: polly v0.1.0" +git push +``` + +2. For polly-git, repeat the above steps with PKGBUILD-polly-git. + +## Updating .SRCINFO + +When updating the PKGBUILD, always regenerate .SRCINFO: + +```bash +makepkg --printsrcinfo > .SRCINFO +git add PKGBUILD .SRCINFO +git commit -m "Update to version X.Y.Z" +git push +``` diff --git a/CHANGES_SUMMARY.md b/CHANGES_SUMMARY.md new file mode 100644 index 0000000..fc0dd25 --- /dev/null +++ b/CHANGES_SUMMARY.md @@ -0,0 +1,135 @@ +# Summary of Changes + +This document summarizes the changes made to add AUR packaging and release workflow. + +## New Files Added + +### AUR Packaging Files +1. **PKGBUILD-polly** - PKGBUILD for stable releases + - Downloads source from GitHub release tags + - Builds and installs to `/usr/bin/polly` + - Includes systemd service installation + +2. **PKGBUILD-polly-git** - PKGBUILD for git development version + - Clones from git repository + - Tracks latest commits + - Provides/conflicts with 'polly' + +3. **polly.install** - Post-install script + - Displays helpful message about enabling the service + - Shows both systemd and manual startup options + +4. **generate-srcinfo.sh** - Helper script + - Generates .SRCINFO files for both packages + - Makes AUR submission easier + +### Release Automation +5. **.github/workflows/release.yml** - GitHub Actions workflow + - Triggered by version tags (v*) + - Builds for three architectures: + - x86_64-unknown-linux-gnu (standard glibc) + - x86_64-unknown-linux-musl (static musl) + - aarch64-unknown-linux-gnu (ARM64) + - Creates GitHub release with binaries + - Uses cross-compilation for musl and ARM targets + +6. **Cross.toml** - Cross-compilation configuration + - Specifies build dependencies for cross targets + - Ensures polkit and glib are available during build + +### System Integration +7. **polly.service** - systemd user service + - Enables auto-start with graphical session + - Includes restart on failure + - Part of graphical-session.target + +### Documentation +8. **AUR_INSTALL.md** - Installation guide + - Instructions for installing from AUR + - How to enable/use the service + - Guide for AUR maintainers + +9. **RELEASE.md** - Release process documentation + - Step-by-step release instructions + - How to update AUR packages + - Testing checklist + +10. **PACKAGING.md** - Packaging overview + - Describes all packaging files + - Documents build targets + - Installation methods + - Maintenance procedures + +## Modified Files + +1. **Readme.md** + - Added installation section + - Links to AUR packages + - Mentions pre-built binaries + - Links to documentation + +2. **.gitignore** + - Added AUR build artifacts (*.tar.gz, *.pkg.tar.zst) + - Added build directories (pkg/, src/) + - Added editor files (.vscode/, .idea/, *.swp) + - Added OS files (.DS_Store, Thumbs.db) + +## How to Use + +### For Users (Installing) + +**Arch Linux:** +```bash +yay -S polly # Stable +yay -S polly-git # Development +``` + +**Other distributions:** +- Download binary from GitHub releases +- Build from source with cargo + +### For Maintainers (Releasing) + +1. Update version in Cargo.toml and PKGBUILD-polly +2. Commit and push changes +3. Create and push tag: `git tag -a v0.1.0 -m "Release v0.1.0"` +4. GitHub Actions automatically builds and releases +5. Update AUR package with new checksums + +### For AUR Maintainers (Submitting) + +```bash +# Clone AUR repo +git clone ssh://aur@aur.archlinux.org/polly.git + +# Copy PKGBUILD +cp PKGBUILD-polly polly/PKGBUILD + +# Generate .SRCINFO +cd polly +makepkg --printsrcinfo > .SRCINFO + +# Commit and push +git add PKGBUILD .SRCINFO +git commit -m "Initial upload: polly 0.1.0" +git push +``` + +## Architecture Support + +Official binaries are built for: +- x86_64 (Intel/AMD 64-bit) - glibc and musl variants +- aarch64 (ARM 64-bit) + +## Dependencies + +**Runtime:** +- glib2 +- polkit + +**Build:** +- rust +- cargo +- libglib2.0-dev +- libpolkit-gobject-1-dev +- libpolkit-agent-1-dev diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..02d7714 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,13 @@ +[target.x86_64-unknown-linux-musl] +image = "ghcr.io/cross-rs/x86_64-unknown-linux-musl:main" +pre-build = [ + "dpkg --add-architecture amd64", + "apt-get update && apt-get install -y libglib2.0-dev:amd64 libpolkit-gobject-1-dev:amd64 libpolkit-agent-1-dev:amd64" +] + +[target.aarch64-unknown-linux-gnu] +image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" +pre-build = [ + "dpkg --add-architecture arm64", + "apt-get update && apt-get install -y libglib2.0-dev:arm64 libpolkit-gobject-1-dev:arm64 libpolkit-agent-1-dev:arm64" +] diff --git a/PACKAGING.md b/PACKAGING.md new file mode 100644 index 0000000..2753f72 --- /dev/null +++ b/PACKAGING.md @@ -0,0 +1,141 @@ +# Packaging Documentation + +This document describes the packaging and distribution setup for polly. + +## Files Overview + +### AUR Packaging +- **PKGBUILD-polly**: Package build script for stable releases from git tags +- **PKGBUILD-polly-git**: Package build script for the development version +- **polly.install**: Post-install script that displays instructions to users +- **generate-srcinfo.sh**: Helper script to generate .SRCINFO files for AUR + +### Release Automation +- **.github/workflows/release.yml**: Automated release workflow that builds binaries for multiple architectures +- **Cross.toml**: Configuration for cross-compilation with required system dependencies + +### System Integration +- **polly.service**: systemd user service for auto-starting polly + +### Documentation +- **AUR_INSTALL.md**: Comprehensive installation guide for AUR users +- **RELEASE.md**: Release process documentation for maintainers + +## Binary Release Workflow + +The release workflow (`.github/workflows/release.yml`) is triggered when: +- A git tag matching `v*` is pushed (e.g., `v0.1.0`) +- Manually via workflow dispatch + +### Build Targets + +The workflow builds binaries for the following targets: + +1. **x86_64-unknown-linux-gnu** + - Standard Linux x86_64 binary + - Dynamically linked against glibc + - Best for most Linux distributions + +2. **x86_64-unknown-linux-musl** + - Static Linux x86_64 binary + - Statically linked against musl libc + - More portable, works on any Linux distro + +3. **aarch64-unknown-linux-gnu** + - ARM64 Linux binary + - For ARM-based systems (Raspberry Pi, etc.) + +### Release Artifacts + +Each release includes: +- Source code (auto-generated by GitHub) +- Binary tarballs for each target architecture +- Release notes (auto-generated from commits) + +## AUR Package Structure + +### polly (Stable) + +The stable package tracks tagged releases: +- Downloads source from GitHub releases +- Builds from a specific version tag +- Updates require manual version bumps + +### polly-git (Development) + +The git package tracks the main branch: +- Clones the git repository +- Builds from the latest commit +- Version is auto-generated from git history + +## Installation Methods + +Users can install polly via: + +1. **AUR (Arch Linux)** + ```bash + yay -S polly # Stable + yay -S polly-git # Development + ``` + +2. **Pre-built Binary** + - Download from GitHub releases + - Extract and copy to `/usr/local/bin/polly` + +3. **From Source** + ```bash + cargo build --release + ``` + +## Post-Installation + +After installation, users can: + +1. **Enable systemd service (recommended)** + ```bash + systemctl --user enable --now polly.service + ``` + +2. **Manual startup** + - Add `polly &` to compositor config + - Run manually: `polly` + +## Maintenance + +### Creating a Release + +1. Update version in `Cargo.toml` and `PKGBUILD-polly` +2. Commit changes +3. Create and push git tag: `git tag -a v0.1.0 -m "Release v0.1.0"` +4. Workflow automatically builds and creates GitHub release + +### Updating AUR + +After a new release: + +1. Update `sha256sums` in `PKGBUILD-polly` +2. Generate .SRCINFO: `makepkg --printsrcinfo > .SRCINFO` +3. Commit and push to AUR repository + +See [RELEASE.md](RELEASE.md) for detailed instructions. + +## Dependencies + +### Runtime +- glib2: GLib library +- polkit: PolicyKit framework + +### Build +- rust: Rust compiler (1.70+) +- cargo: Rust package manager +- libglib2.0-dev: GLib development files +- libpolkit-gobject-1-dev: Polkit GObject development files +- libpolkit-agent-1-dev: Polkit agent development files + +## Architecture Support + +Officially supported architectures: +- x86_64 (Intel/AMD 64-bit) +- aarch64 (ARM 64-bit) + +Other architectures may work but are not officially supported or tested. diff --git a/PKGBUILD-polly b/PKGBUILD-polly new file mode 100644 index 0000000..42d4b4a --- /dev/null +++ b/PKGBUILD-polly @@ -0,0 +1,31 @@ +# Maintainer: Manthan M. Patil +pkgname=polly +pkgver=0.1.0 +pkgrel=1 +pkgdesc="A Polkit authentication agent for Wayland desktops" +arch=('x86_64' 'aarch64') +url="https://github.com/manthanabc/polkit-agent" +license=('MIT') +depends=('glib2' 'polkit') +makedepends=('rust' 'cargo') +install=polly.install +source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz") +sha256sums=('SKIP') + +build() { + cd "$srcdir/polkit-agent-$pkgver" + cargo build --release --locked +} + +check() { + cd "$srcdir/polkit-agent-$pkgver" + cargo test --release --locked +} + +package() { + cd "$srcdir/polkit-agent-$pkgver" + install -Dm755 "target/release/polkit-agent" "$pkgdir/usr/bin/polly" + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + install -Dm644 Readme.md "$pkgdir/usr/share/doc/$pkgname/README.md" + install -Dm644 polly.service "$pkgdir/usr/lib/systemd/user/polly.service" +} diff --git a/PKGBUILD-polly-git b/PKGBUILD-polly-git new file mode 100644 index 0000000..1fbee5c --- /dev/null +++ b/PKGBUILD-polly-git @@ -0,0 +1,38 @@ +# Maintainer: Manthan M. Patil +pkgname=polly-git +pkgver=r1.0.1.0 +pkgrel=1 +pkgdesc="A Polkit authentication agent for Wayland desktops (git version)" +arch=('x86_64' 'aarch64') +url="https://github.com/manthanabc/polkit-agent" +license=('MIT') +depends=('glib2' 'polkit') +makedepends=('rust' 'cargo' 'git') +provides=('polly') +conflicts=('polly') +install=polly.install +source=("git+$url.git") +sha256sums=('SKIP') + +pkgver() { + cd "$srcdir/polkit-agent" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +build() { + cd "$srcdir/polkit-agent" + cargo build --release --locked +} + +check() { + cd "$srcdir/polkit-agent" + cargo test --release --locked +} + +package() { + cd "$srcdir/polkit-agent" + install -Dm755 "target/release/polkit-agent" "$pkgdir/usr/bin/polly" + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + install -Dm644 Readme.md "$pkgdir/usr/share/doc/$pkgname/README.md" + install -Dm644 polly.service "$pkgdir/usr/lib/systemd/user/polly.service" +} diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..989a3f9 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,119 @@ +# Release Process + +This document outlines the process for creating a new release of polly. + +## Creating a Release + +### 1. Update Version + +Update the version in `Cargo.toml`: + +```toml +[package] +version = "X.Y.Z" +``` + +Update the version in `PKGBUILD-polly`: + +```bash +pkgver=X.Y.Z +``` + +### 2. Update Changelog + +Create or update CHANGELOG.md with the changes in this release. + +### 3. Commit Changes + +```bash +git add Cargo.toml PKGBUILD-polly CHANGELOG.md +git commit -m "Bump version to vX.Y.Z" +git push +``` + +### 4. Create and Push Tag + +```bash +git tag -a vX.Y.Z -m "Release vX.Y.Z" +git push origin vX.Y.Z +``` + +### 5. Automated Build + +The GitHub Actions workflow will automatically: +- Build binaries for x86_64-unknown-linux-gnu +- Build binaries for x86_64-unknown-linux-musl +- Build binaries for aarch64-unknown-linux-gnu +- Create a GitHub release with all binaries attached + +### 6. Update AUR Package + +After the release is created: + +1. Update `PKGBUILD-polly` with the new checksum: + +```bash +# Download the release tarball +wget https://github.com/manthanabc/polkit-agent/archive/refs/tags/vX.Y.Z.tar.gz + +# Generate checksum +sha256sum vX.Y.Z.tar.gz +``` + +2. Update the `sha256sums` in `PKGBUILD-polly` + +3. Generate new .SRCINFO: + +```bash +makepkg --printsrcinfo -p PKGBUILD-polly > .SRCINFO +``` + +4. Update AUR repository: + +```bash +cd /path/to/aur/polly +cp /path/to/polkit-agent/PKGBUILD-polly PKGBUILD +makepkg --printsrcinfo > .SRCINFO +git add PKGBUILD .SRCINFO +git commit -m "Update to vX.Y.Z" +git push +``` + +## Manual Build + +To manually build release binaries without creating a tag: + +```bash +# Build for current platform +cargo build --release + +# Build for specific target +cargo build --release --target x86_64-unknown-linux-gnu + +# Build with cross for other platforms +cross build --release --target aarch64-unknown-linux-gnu +``` + +## Testing Before Release + +Before creating a release, ensure: + +1. All tests pass: +```bash +cargo test +``` + +2. The binary builds successfully: +```bash +cargo build --release +``` + +3. The PKGBUILD works: +```bash +makepkg -p PKGBUILD-polly +``` + +4. The systemd service is valid: +```bash +systemd-analyze verify polly.service +``` diff --git a/Readme.md b/Readme.md index 33a2922..9fa6eec 100644 --- a/Readme.md +++ b/Readme.md @@ -16,13 +16,36 @@ A Polkit authentication agent for Wayland desktops, built with `iced_layershell` * [ ] Use system theme for a more integrated look and feel * [ ] CSS-based styling for customization -## Building from Source +## Installation + +### Arch Linux (AUR) + +The easiest way to install on Arch Linux is via the AUR: + +```sh +# Stable version +yay -S polly + +# Development version +yay -S polly-git +``` + +See [AUR_INSTALL.md](AUR_INSTALL.md) for detailed instructions. + +### Pre-built Binaries + +Download pre-built binaries from the [releases page](https://github.com/manthanabc/polkit-agent/releases) for: +- x86_64 (glibc) +- x86_64 (musl - static) +- aarch64 (ARM64) + +### Building from Source To build the Wayland Polkit Agent from source, you'll need to have Rust and Cargo installed. 1. Clone the repository: ```sh - git clone https://github.com/your-username/polkit-agent.git + git clone https://github.com/manthanabc/polkit-agent.git ``` 2. Build the project: ```sh diff --git a/generate-srcinfo.sh b/generate-srcinfo.sh new file mode 100755 index 0000000..4f1b2b2 --- /dev/null +++ b/generate-srcinfo.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Script to generate .SRCINFO files for AUR packages + +set -e + +echo "Generating .SRCINFO for polly..." +makepkg --printsrcinfo -p PKGBUILD-polly > PKGBUILD-polly.SRCINFO +echo "✓ Generated PKGBUILD-polly.SRCINFO" + +echo "Generating .SRCINFO for polly-git..." +makepkg --printsrcinfo -p PKGBUILD-polly-git > PKGBUILD-polly-git.SRCINFO +echo "✓ Generated PKGBUILD-polly-git.SRCINFO" + +echo "" +echo "Done! Copy the appropriate files to your AUR repository:" +echo " For polly: cp PKGBUILD-polly PKGBUILD && cp PKGBUILD-polly.SRCINFO .SRCINFO" +echo " For polly-git: cp PKGBUILD-polly-git PKGBUILD && cp PKGBUILD-polly-git.SRCINFO .SRCINFO" diff --git a/polly.install b/polly.install new file mode 100644 index 0000000..b74c2b3 --- /dev/null +++ b/polly.install @@ -0,0 +1,14 @@ +post_install() { + echo "" + echo "==> Polly - Wayland Polkit Authentication Agent" + echo "==> To enable polly, run one of the following:" + echo "==> " + echo "==> systemctl --user enable --now polly.service" + echo "==> " + echo "==> Or add 'polly &' to your compositor's autostart configuration" + echo "" +} + +post_upgrade() { + post_install +} diff --git a/polly.service b/polly.service new file mode 100644 index 0000000..2e8ab23 --- /dev/null +++ b/polly.service @@ -0,0 +1,13 @@ +[Unit] +Description=Polly - Wayland Polkit Authentication Agent +Documentation=https://github.com/manthanabc/polkit-agent +After=graphical-session.target + +[Service] +Type=simple +ExecStart=/usr/bin/polly +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=graphical-session.target