feat: multi arch support (#175)

* feat: multi arch support

* fix: sanitize GTK environment

Co-authored-by: kinou-p <kinou-p@users.noreply.github.com>
This commit is contained in:
Gustavo Carvalho
2026-02-13 20:59:40 -03:00
parent d1af288f5c
commit 0cde431e72
5 changed files with 321 additions and 81 deletions

View File

@@ -12,9 +12,21 @@ env:
CARGO_TERM_COLOR: always
jobs:
build-and-release:
name: Build and Release
runs-on: ubuntu-latest
build:
name: Build (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-latest
deb_arch: amd64
rpm_arch: x86_64
- arch: aarch64
runner: ubuntu-24.04-arm
deb_arch: arm64
rpm_arch: aarch64
steps:
- name: Checkout repository
uses: actions/checkout@v6
@@ -25,8 +37,6 @@ jobs:
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
# --- BUILD STEPS ---
- name: Setup Node.js
uses: actions/setup-node@v6
with:
@@ -45,7 +55,7 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-${{ matrix.arch }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
- name: Install system dependencies
run: |
@@ -58,13 +68,9 @@ jobs:
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
echo "Syncing version to $VERSION"
# Update package.json
npm version $VERSION --no-git-tag-version --allow-same-version
# Update tauri.conf.json (handles semver with pre-release like 1.0.0-beta.1)
sed -i 's/"version": "[^"]*"/"version": "'"$VERSION"'"/' src-tauri/tauri.conf.json
# Update Cargo.toml (first occurrence only, handles semver with pre-release)
sed -i '0,/^version = "[^"]*"/s//version = "'"$VERSION"'"/' src-tauri/Cargo.toml
# Verify versions were updated
echo "=== Versions after sync ==="
echo "package.json: $(grep '"version"' package.json | head -1)"
echo "tauri.conf.json: $(grep '"version"' src-tauri/tauri.conf.json | head -1)"
@@ -76,8 +82,37 @@ jobs:
- name: Build Tauri app
run: npm run tauri:build
# --- RELEASE STEP ---
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.arch }}
path: |
src-tauri/target/release/bundle/deb/*.deb
src-tauri/target/release/bundle/appimage/*.AppImage
src-tauri/target/release/bundle/rpm/*.rpm
retention-days: 1
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: List artifacts
run: find artifacts -type f | head -50
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
@@ -88,21 +123,28 @@ jobs:
draft: false
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') || contains(github.ref_name, 'dev') }}
files: |
src-tauri/target/release/bundle/deb/*.deb
src-tauri/target/release/bundle/appimage/*.AppImage
src-tauri/target/release/bundle/rpm/*.rpm
artifacts/**/*.deb
artifacts/**/*.AppImage
artifacts/**/*.rpm
body: |
## Windows 11 Clipboard History For Linux ${{ github.ref_name }}
A Windows 11-style Clipboard History Manager for Linux.
### Supported Architectures
| Architecture | Debian/Ubuntu | Fedora/RHEL | AppImage |
|---|---|---|---|
| x86_64 (Intel/AMD) | ✅ | ✅ | ✅ |
| aarch64 (ARM64) | ✅ | ✅ | ✅ |
### 🚀 Quick Installation (Recommended)
```bash
curl -fsSL https://raw.githubusercontent.com/gustavosett/Windows-11-Clipboard-History-For-Linux/master/scripts/install.sh | bash
```
This script auto-detects your distro and sets up everything, including paste permissions.
This script auto-detects your distro and architecture, then sets up everything including paste permissions.
---
@@ -115,7 +157,7 @@ jobs:
sudo setfacl -m u:$USER:rw /dev/uinput # For immediate paste access
```
Or download the `.deb` directly:
Or download the `.deb` directly (amd64 for x86_64, arm64 for ARM64):
```bash
sudo apt install ./win11-clipboard-history_${{ steps.get_version.outputs.VERSION }}_amd64.deb
sudo setfacl -m u:$USER:rw /dev/uinput
@@ -128,7 +170,7 @@ jobs:
sudo setfacl -m u:$USER:rw /dev/uinput # For immediate paste access
```
Or download the `.rpm` directly:
Or download the `.rpm` directly (x86_64 for Intel/AMD, aarch64 for ARM64):
```bash
sudo dnf install ./win11-clipboard-history-${{ steps.get_version.outputs.VERSION }}-1.x86_64.rpm
sudo setfacl -m u:$USER:rw /dev/uinput
@@ -141,7 +183,7 @@ jobs:
#### AppImage (Universal - any distro)
```bash
# Download, make executable, and set up paste permissions
# Download the correct AppImage for your architecture
chmod +x win11-clipboard-history_${{ steps.get_version.outputs.VERSION }}_amd64.AppImage
sudo setfacl -m u:$USER:rw /dev/uinput # Required for paste simulation
./win11-clipboard-history_${{ steps.get_version.outputs.VERSION }}_amd64.AppImage
@@ -172,15 +214,29 @@ jobs:
echo "Uploading STABLE release v$VERSION to Cloudsmith..."
# Upload .deb
cloudsmith push deb gustavosett/clipboard-manager/any-distro/any-version \
src-tauri/target/release/bundle/deb/*.deb \
--api-key $CLOUDSMITH_API_KEY || echo "Cloudsmith .deb upload failed (may already exist)"
# Upload all .deb files (x86_64 and arm64)
deb_files=$(find artifacts -name '*.deb' 2>/dev/null)
if [ -n "$deb_files" ]; then
echo "$deb_files" | while read -r deb; do
echo "Uploading $deb..."
cloudsmith push deb gustavosett/clipboard-manager/any-distro/any-version \
"$deb" --api-key $CLOUDSMITH_API_KEY || echo "Cloudsmith .deb upload failed for $deb (may already exist)"
done
else
echo "No .deb files found to upload"
fi
# Upload .rpm
cloudsmith push rpm gustavosett/clipboard-manager/any-distro/any-version \
src-tauri/target/release/bundle/rpm/*.rpm \
--api-key $CLOUDSMITH_API_KEY || echo "Cloudsmith .rpm upload failed (may already exist)"
# Upload all .rpm files (x86_64 and aarch64)
rpm_files=$(find artifacts -name '*.rpm' 2>/dev/null)
if [ -n "$rpm_files" ]; then
echo "$rpm_files" | while read -r rpm; do
echo "Uploading $rpm..."
cloudsmith push rpm gustavosett/clipboard-manager/any-distro/any-version \
"$rpm" --api-key $CLOUDSMITH_API_KEY || echo "Cloudsmith .rpm upload failed for $rpm (may already exist)"
done
else
echo "No .rpm files found to upload"
fi
- name: Update AUR Package
if: ${{ !contains(github.ref_name, 'alpha') && !contains(github.ref_name, 'beta') && !contains(github.ref_name, 'rc') && !contains(github.ref_name, 'dev') }}
@@ -194,10 +250,25 @@ jobs:
fi
VERSION=${{ steps.get_version.outputs.VERSION }}
DEB_FILE=$(ls src-tauri/target/release/bundle/deb/*.deb | head -1)
SHA256=$(sha256sum "$DEB_FILE" | cut -d' ' -f1)
echo "Updating AUR package to version $VERSION with checksum $SHA256"
# Compute checksums for each architecture
DEB_X86_64=$(find artifacts -name "*_amd64.deb" | head -1)
DEB_ARM64=$(find artifacts -name "*_arm64.deb" | head -1)
if [ -z "$DEB_X86_64" ]; then
echo "x86_64 .deb not found, skipping AUR update"
exit 0
fi
SHA256_X86_64=$(sha256sum "$DEB_X86_64" | cut -d' ' -f1)
SHA256_ARM64=""
if [ -n "$DEB_ARM64" ]; then
SHA256_ARM64=$(sha256sum "$DEB_ARM64" | cut -d' ' -f1)
fi
echo "Updating AUR package to version $VERSION"
echo "x86_64 checksum: $SHA256_X86_64"
echo "arm64 checksum: ${SHA256_ARM64:-SKIP}"
# Setup SSH for AUR
mkdir -p ~/.ssh
@@ -212,10 +283,19 @@ jobs:
git clone ssh://aur@aur.archlinux.org/win11-clipboard-history-bin.git /tmp/aur-pkg
cd /tmp/aur-pkg
# Update PKGBUILD
# Use aur/PKGBUILD from the repo as the single source of truth
cp "$GITHUB_WORKSPACE/aur/PKGBUILD" PKGBUILD
cp "$GITHUB_WORKSPACE/aur/win11-clipboard-history-bin.install" . 2>/dev/null || true
# Update version and checksums via sed
sed -i "s/^pkgver=.*/pkgver=$VERSION/" PKGBUILD
sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD
sed -i "s/sha256sums_x86_64=.*/sha256sums_x86_64=('$SHA256')/" PKGBUILD
sed -i "s/sha256sums_x86_64=.*/sha256sums_x86_64=('$SHA256_X86_64')/" PKGBUILD
if [ -n "$SHA256_ARM64" ]; then
sed -i "s/sha256sums_aarch64=.*/sha256sums_aarch64=('$SHA256_ARM64')/" PKGBUILD
else
sed -i "s/sha256sums_aarch64=.*/sha256sums_aarch64=('SKIP')/" PKGBUILD
fi
# Generate .SRCINFO
docker run --rm -v "$PWD:/pkg" archlinux bash -c "
@@ -223,30 +303,39 @@ jobs:
cd /pkg
makepkg --printsrcinfo > .SRCINFO
" || {
# Fallback: generate manually if docker fails
echo "pkgbase = win11-clipboard-history-bin
pkgdesc = Windows 11-style Clipboard History Manager for Linux
pkgver = $VERSION
pkgrel = 1
url = https://github.com/gustavosett/Windows-11-Clipboard-History-For-Linux
arch = x86_64
license = MIT
depends = webkit2gtk-4.1
depends = gtk3
depends = libayatana-appindicator
depends = xclip
depends = wl-clipboard
depends = acl
optdepends = libappindicator-gtk3: Legacy tray icon support
provides = win11-clipboard-history
conflicts = win11-clipboard-history
options = !strip
options = !debug
source_x86_64 = https://github.com/gustavosett/Windows-11-Clipboard-History-For-Linux/releases/download/v$VERSION/win11-clipboard-history_${VERSION}_amd64.deb
sha256sums_x86_64 = $SHA256
install = win11-clipboard-history-bin.install
echo "Docker failed, generating .SRCINFO manually"
TAB=$'\t'
cat > .SRCINFO << SRCINFO_EOF
pkgbase = win11-clipboard-history-bin
${TAB}pkgdesc = Windows 11-style Clipboard History Manager for Linux
${TAB}pkgver = $VERSION
${TAB}pkgrel = 1
${TAB}url = https://github.com/gustavosett/Windows-11-Clipboard-History-For-Linux
${TAB}install = win11-clipboard-history-bin.install
${TAB}arch = x86_64
${TAB}arch = aarch64
${TAB}license = MIT
${TAB}depends = webkit2gtk-4.1
${TAB}depends = gtk3
${TAB}depends = libayatana-appindicator
${TAB}depends = xclip
${TAB}depends = xdotool
${TAB}depends = wl-clipboard
${TAB}depends = acl
${TAB}depends = polkit
${TAB}optdepends = libappindicator-gtk3: Legacy tray icon support
${TAB}provides = win11-clipboard-history
${TAB}conflicts = win11-clipboard-history
${TAB}options = !strip
${TAB}options = !debug
${TAB}source_x86_64 = https://github.com/gustavosett/Windows-11-Clipboard-History-For-Linux/releases/download/v$VERSION/win11-clipboard-history_${VERSION}_amd64.deb
${TAB}sha256sums_x86_64 = $SHA256_X86_64
${TAB}source_aarch64 = https://github.com/gustavosett/Windows-11-Clipboard-History-For-Linux/releases/download/v$VERSION/win11-clipboard-history_${VERSION}_arm64.deb
${TAB}sha256sums_aarch64 = ${SHA256_ARM64:-SKIP}
pkgname = win11-clipboard-history-bin" > .SRCINFO
pkgname = win11-clipboard-history-bin
SRCINFO_EOF
sed -i 's/^ //' .SRCINFO
}
# Commit and push