added ci + readme

This commit is contained in:
nvrl committed 2026-06-30 03:43:59 +02:00
1 parent 862740c4ee
commit f69ddd9ee8
4 files changed
+313 -4

No files matched your search

+189
View File
@@ -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 <<EOF > deb/DEBIAN/control
Package: proton-drive-linux
Version: ${{ env.VERSION }}
Section: utils
Priority: optional
Architecture: amd64
Maintainer: Nils Pukropp <contact@narl.io>
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 }}