From f69ddd9ee8c8edd636a1a56f35304714f523c567 Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Tue, 30 Jun 2026 03:43:59 +0200 Subject: [PATCH] added ci + readme --- .github/workflows/release.yml | 189 ++++++++++++++++++++++++++++++++++ Cargo.lock | 8 +- Cargo.toml | 4 +- README.md | 116 +++++++++++++++++++++ 4 files changed, 313 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 README.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ac8ae87 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,189 @@ +name: Release + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +permissions: + contents: write + +jobs: + build-release: + name: Build and Release + runs-on: ubuntu-24.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + pkg-config \ + libfuse3-dev \ + libgtk-4-dev \ + libadwaita-1-dev \ + libsecret-1-dev \ + libdbus-1-dev \ + desktop-file-utils + + - name: Set up Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + + - name: Cache Cargo target + uses: swatinem/rust-cache@v2 + + - name: Build release binaries + run: | + cargo build --release --locked + + - name: Determine version + run: | + if [[ $GITHUB_REF == refs/tags/* ]]; then + # Extract version from tag (e.g. v0.1.0 -> 0.1.0) + VERSION=${GITHUB_REF#refs/tags/} + VERSION=${VERSION#v} + else + # Fallback for manual workflow runs: extract version from Cargo.toml + VERSION=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2) + VERSION="${VERSION}-dev-${GITHUB_SHA::7}" + fi + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "Building version: $VERSION" + + - name: Package raw binaries (.tar.gz) + run: | + mkdir -p dist/binaries + cp target/release/pdfs dist/binaries/ + cp target/release/pdfs-tray dist/binaries/ + cp target/release/pdfs-app dist/binaries/ + + # Create tarball + tar -czf proton-drive-linux-${{ env.VERSION }}-x86_64.tar.gz -C dist/binaries . + + - name: Package Debian package (.deb) + run: | + mkdir -p deb/DEBIAN + mkdir -p deb/usr/bin + mkdir -p deb/usr/share/applications + mkdir -p deb/usr/share/icons/hicolor/scalable/apps + mkdir -p deb/usr/share/licenses/proton-drive-linux + + # Copy binaries + cp target/release/pdfs deb/usr/bin/ + cp target/release/pdfs-tray deb/usr/bin/ + cp target/release/pdfs-app deb/usr/bin/ + + # Copy desktop integration files + cp packaging/io.narl.proton-drive-linux.desktop deb/usr/share/applications/ + cp packaging/io.narl.proton-drive-linux.svg deb/usr/share/icons/hicolor/scalable/apps/ + cp LICENSE deb/usr/share/licenses/proton-drive-linux/ + + # Calculate Installed-Size in KB for the control file + INSTALLED_SIZE=$(du -sk deb | cut -f1) + + # Write DEBIAN/control file + cat < deb/DEBIAN/control + Package: proton-drive-linux + Version: ${{ env.VERSION }} + Section: utils + Priority: optional + Architecture: amd64 + Maintainer: Nils Pukropp + Depends: fuse3, libgtk-4-1 (>= 4.12.0), libadwaita-1-0 (>= 1.5.0), libsecret-1-0 + Installed-Size: ${INSTALLED_SIZE} + Description: Proton Drive client for Linux + Proton Drive client for Linux featuring: + - FUSE files-on-demand mount + - Command-line interface (CLI) + - GTK4 system tray and desktop application + EOF + + # Build Debian package + dpkg-deb --build deb proton-drive-linux_${{ env.VERSION }}_amd64.deb + + - name: Package AppImage (.AppImage) + run: | + # 1. Set up AppDir structure + mkdir -p AppDir/usr/bin + mkdir -p AppDir/usr/share/applications + mkdir -p AppDir/usr/share/icons/hicolor/scalable/apps + + # Copy binaries + cp target/release/pdfs AppDir/usr/bin/ + cp target/release/pdfs-tray AppDir/usr/bin/ + cp target/release/pdfs-app AppDir/usr/bin/ + + # Copy desktop integration files + cp packaging/io.narl.proton-drive-linux.desktop AppDir/usr/share/applications/ + cp packaging/io.narl.proton-drive-linux.svg AppDir/usr/share/icons/hicolor/scalable/apps/ + + # Create required AppImage root symlinks + ln -s usr/share/applications/io.narl.proton-drive-linux.desktop AppDir/ + ln -s usr/share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg AppDir/ + + # 2. Write custom AppRun to support multi-call execution + cat <<'EOF' > AppDir/AppRun + #!/bin/sh + HERE="$(dirname "$(readlink -f "${0}")")" + ARG0="$(basename "${0}")" + case "${ARG0}" in + pdfs) + exec "${HERE}/usr/bin/pdfs" "$@" + ;; + pdfs-tray) + exec "${HERE}/usr/bin/pdfs-tray" "$@" + ;; + pdfs-app) + exec "${HERE}/usr/bin/pdfs-app" "$@" + ;; + *) + # Support running a specific binary by passing its name as first arg + if [ "$1" = "pdfs" ] || [ "$1" = "pdfs-tray" ] || [ "$1" = "pdfs-app" ]; then + CMD="$1" + shift + exec "${HERE}/usr/bin/${CMD}" "$@" + else + # Default behavior: run GUI app + exec "${HERE}/usr/bin/pdfs-app" "$@" + fi + ;; + esac + EOF + chmod +x AppDir/AppRun + + # 3. Download and extract appimagetool (avoids FUSE mount failures in CI) + curl -Lo appimagetool https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage + chmod +x appimagetool + ./appimagetool --appimage-extract + + # 4. Generate AppImage + ARCH=x86_64 ./squashfs-root/AppRun AppDir proton-drive-linux-${{ env.VERSION }}-x86_64.AppImage + + - name: Upload Workflow Artifacts + uses: actions/upload-artifact@v4 + with: + name: proton-drive-linux-builds + path: | + *.deb + *.AppImage + *.tar.gz + if-no-files-found: error + + - name: Create GitHub Release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 + with: + files: | + *.deb + *.AppImage + *.tar.gz + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Cargo.lock b/Cargo.lock index 33c77bd..b8c1610 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3031,7 +3031,9 @@ dependencies = [ [[package]] name = "proton-drive-rs" -version = "0.1.1" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9380c88a032e2ff079b2d5a6221ccc40ebeee3ebbb4ea60d4d65ef770e4ca8d" dependencies = [ "async-trait", "base64", @@ -3054,7 +3056,9 @@ dependencies = [ [[package]] name = "proton-sdk" -version = "0.1.1" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1da22604d2568af2d15be6a45f23f8c5b95fa775bdac1540e833c2eafb587888" dependencies = [ "aes-gcm", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 6922252..dd61b0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,8 @@ rust-version = "1.96" [workspace.dependencies] # Local Proton SDK crates (path deps until published; switch to versioned later). -proton-sdk = { path = "../proton-sdk-rs/crates/proton-sdk" } -proton-drive-rs = { path = "../proton-sdk-rs/crates/proton-drive-rs" } +proton-sdk = "0.1" +proton-drive-rs = "0.1" # Internal crates. pdfs-core = { path = "crates/pdfs-core" } diff --git a/README.md b/README.md new file mode 100644 index 0000000..ff90f56 --- /dev/null +++ b/README.md @@ -0,0 +1,116 @@ +# Proton Drive client for Linux (unofficial) + +A fast, unofficial Proton Drive client for Linux. This client provides a FUSE files-on-demand virtual mount, a command-line interface (CLI), and a GTK4 desktop application with system tray integration. + +## Features + +- **Files-on-demand (FUSE)**: Mount your Proton Drive as a virtual filesystem where files are downloaded only when opened. +- **Command-Line Interface (CLI)**: Manage your drive, authenticate, and monitor sync status directly from the terminal. +- **GTK4 Desktop App**: Log in, browse files, and configure sync options through a modern, native Linux GUI. +- **System Tray Integration**: Background indicator for status monitoring, quick actions, and fast sync controls. +- **Secure Credential Storage**: Integrates with the system Secret Service (GNOME Keyring, KWallet, etc.) for safe token storage. + +--- + +## Prerequisites + +To compile the application from source or run the built binaries, ensure you have the following system libraries installed on your distribution: + +### Ubuntu / Debian (24.04+) +```bash +sudo apt-get update +sudo apt-get install -y \ + pkg-config \ + libfuse3-dev \ + libgtk-4-dev \ + libadwaita-1-dev \ + libsecret-1-dev \ + libdbus-1-dev +``` + +### Arch Linux +```bash +sudo pacman -S --needed pkgconf fuse3 gtk4 libadwaita libsecret dbus +``` + +--- + +## Building from Source + +Ensure you have Rust and Cargo installed (minimum supported Rust version is 1.96). + +1. Clone the repository and navigate into the project directory: + ```bash + git clone https://github.com/narl/proton-drive-linux.git + cd proton-drive-linux + ``` +2. Build the workspace in release mode: + ```bash + cargo build --release --locked + ``` + +The compiled binaries will be available under `target/release/`: +- `pdfs`: The CLI utility. +- `pdfs-app`: The GTK4 application. +- `pdfs-tray`: The tray status notifier. + +--- + +## Installation & Packages + +### 1. Debian / Ubuntu (.deb) +Install the debian package via `dpkg` or `apt`: +```bash +sudo apt install ./proton-drive-linux_*.deb +``` + +### 2. AppImage (.AppImage) +The AppImage is a portable build that packages all binaries. Make it executable and run it: +```bash +chmod +x proton-drive-linux-*.AppImage +./proton-drive-linux-*.AppImage +``` + +> [!TIP] +> The AppImage is a multi-call binary. By default, running it launches the GUI. You can run the CLI or the Tray app by passing their name as the first argument, or by renaming/symlinking the AppImage file: +> ```bash +> # Run CLI +> ./proton-drive-linux-*.AppImage pdfs --help +> +> # Run Tray +> ./proton-drive-linux-*.AppImage pdfs-tray +> ``` + +### 3. Arch Linux +A local `PKGBUILD` is available under the `packaging/` directory. You can build and install it using: +```bash +cd packaging && makepkg -fi +``` + +--- + +## Automated Releases (CI/CD) + +This project has a GitHub Actions CI workflow configured under `.github/workflows/release.yml`. + +### How it works: +1. **Triggers**: + - Pushing a git tag matching `v*` (e.g. `git tag v0.1.0 && git push origin v0.1.0`). + - Manual runs via the **Actions** tab in GitHub (**workflow_dispatch**). +2. **Build Process**: + - Spawns an Ubuntu runner and installs GTK4, Libadwaita, FUSE3, and Secret Service packages. + - Sets up the Rust compiler and caches build targets to speed up runs. + - Compiles the workspace members in release mode. +3. **Artifact Packaging**: + - Generates a `.tar.gz` containing the raw binaries (`pdfs`, `pdfs-app`, `pdfs-tray`). + - Packs them into a Debian package (`.deb`). + - Builds a portable AppImage using `appimagetool` without requiring FUSE inside CI. +4. **Publishing**: + - Creates a GitHub Release matching the pushed tag and uploads the `.deb`, `.AppImage`, and `.tar.gz` packages as release assets. + - For manual runs, compiles and exposes the packages as workflow run artifacts for testing. + +--- + +## License + +This project is licensed under the [MIT License](LICENSE).