aur setup

This commit is contained in:
LeonardoTrapani
2025-09-07 20:51:23 +02:00
parent de20033c1a
commit 2631293d12
10 changed files with 804 additions and 83 deletions
+38
View File
@@ -0,0 +1,38 @@
# Maintainer: Leonardo Trapani <leo@trapani.sh>
pkgname=hyprvoice-bin
pkgver=0.1.0
pkgrel=1
pkgdesc="Voice-powered typing for Wayland/Hyprland"
arch=('x86_64')
url="https://github.com/leonardotrapani/hyprvoice"
license=('MIT')
depends=(
'pipewire'
'pipewire-pulse'
'pipewire-audio'
'wl-clipboard'
'wtype'
'libnotify'
'systemd'
)
optdepends=(
'hyprland: For Hyprland window manager integration'
'sway: For Sway window manager integration'
)
provides=('hyprvoice')
conflicts=('hyprvoice')
source=(
"hyprvoice-${pkgver}::https://github.com/leonardotrapani/hyprvoice/releases/download/v${pkgver}/hyprvoice-linux-x86_64"
"hyprvoice.service"
)
sha256sums=('SKIP' # Update this with: updpkgsums after first release
'SKIP') # Update this with: sha256sum hyprvoice.service
install=hyprvoice.install
package() {
# Install binary
install -Dm755 "hyprvoice-${pkgver}" "${pkgdir}/usr/bin/hyprvoice"
# Install systemd service file
install -Dm644 hyprvoice.service "${pkgdir}/usr/lib/systemd/user/hyprvoice.service"
}
+110
View File
@@ -0,0 +1,110 @@
# Release Process
This document describes how to create a new release of hyprvoice.
## Automated Release Process
### 1. Create a Release Tag
```bash
# Make sure you're on main branch with latest changes
git checkout main
git pull origin main
# Create and push a version tag
git tag v0.1.0
git push origin v0.1.0
```
### 2. GitHub Actions Automatically:
- ✅ Builds the binary with CGO for Linux x86_64
- ✅ Runs all tests
- ✅ Creates a GitHub release with changelog
- ✅ Uploads `hyprvoice-linux-x86_64` binary
- ✅ Generates and uploads SHA256 checksums
### 3. Update AUR Package
```bash
cd packaging/
./update-aur.sh 0.1.0
```
That's it! The script handles everything:
- Updates PKGBUILD version and checksums
- Copies files to AUR repository
- Generates .SRCINFO
- Tests the build
- Commits and pushes to AUR (with confirmation)
## Manual Release (if needed)
### Build Binary
```bash
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o hyprvoice-linux-x86_64 ./cmd/hyprvoice
```
### Create Release
1. Go to GitHub Releases
2. Click "Create a new release"
3. Tag: `v0.1.0`
4. Release title: `Release 0.1.0`
5. Upload `hyprvoice-linux-x86_64`
6. Publish release
## Version Scheme
- **Major.Minor.Patch** (e.g., `0.1.0`)
- **Major**: Breaking changes
- **Minor**: New features, backwards compatible
- **Patch**: Bug fixes, small improvements
## Complete Release Checklist
### Pre-release
- [ ] All tests pass: `go test ./...`
- [ ] Binary builds: `go build ./cmd/hyprvoice`
- [ ] Configure command works: `./hyprvoice configure --help`
- [ ] Version bumped in any relevant files
- [ ] Changes documented
### GitHub Release
- [ ] Create and push version tag: `git tag v0.1.0 && git push origin v0.1.0`
- [ ] Verify GitHub Actions completed successfully
- [ ] Verify binary uploaded to GitHub releases
- [ ] Verify checksums generated
### AUR Package Update (if AUR package exists)
- [ ] Run complete AUR update: `./packaging/update-aur.sh 0.1.0`
- [ ] Verify AUR package page updated
### Post-release Verification
- [ ] Test AUR installation: `yay -S hyprvoice-bin`
- [ ] Test configure command: `hyprvoice configure`
- [ ] Test service: `systemctl --user status hyprvoice.service`
- [ ] Update project README if needed
## Files Updated in Release
- `packaging/PKGBUILD` - Version and checksums
- GitHub Release - Binary and checksums
- AUR repository - Updated package
## Troubleshooting
### Build Fails
- Check that all CGO dependencies are installed
- Ensure Go version matches workflow (1.21+)
### AUR Package Issues
- Run `makepkg -si` to test locally
- Check checksums match: `updpkgsums`
- Verify binary downloads correctly
### GitHub Actions Issues
- Check workflow logs in Actions tab
- Ensure tag follows `v*` pattern
- Verify GITHUB_TOKEN has necessary permissions
+43
View File
@@ -0,0 +1,43 @@
post_install() {
echo "==> Hyprvoice installation complete!"
echo ""
echo " 📋 Next steps (in order):"
echo " 1. Configure hyprvoice: hyprvoice configure"
echo " 2. Enable the service: systemctl --user enable --now hyprvoice.service"
echo " 3. Add keybinding to your window manager config"
echo ""
echo " 🔑 For Hyprland, add to ~/.config/hypr/hyprland.conf:"
echo " bind = SUPER, R, exec, hyprvoice toggle"
echo ""
echo " 💡 The configure step will guide you through API key setup and preferences."
echo ""
}
post_upgrade() {
echo "==> Hyprvoice has been upgraded."
echo ""
echo " 📋 Next steps:"
echo " 1. Restart the service: systemctl --user restart hyprvoice.service"
echo " 2. Check for new options: hyprvoice configure"
echo ""
}
pre_remove() {
# Stop and disable service if running
if systemctl --user is-active --quiet hyprvoice.service 2>/dev/null; then
echo "==> Stopping hyprvoice service..."
systemctl --user stop hyprvoice.service 2>/dev/null || true
fi
if systemctl --user is-enabled --quiet hyprvoice.service 2>/dev/null; then
echo "==> Disabling hyprvoice service..."
systemctl --user disable hyprvoice.service 2>/dev/null || true
fi
}
post_remove() {
echo "==> Hyprvoice has been removed."
echo " Configuration files remain in ~/.config/hyprvoice/"
echo " Cache files remain in ~/.cache/hyprvoice/"
echo " Remove them manually if desired."
}
+15
View File
@@ -0,0 +1,15 @@
[Unit]
Description=Hyprvoice voice-to-text daemon
Documentation=https://github.com/leonardotrapani/hyprvoice
After=pipewire.service
Wants=pipewire.service
[Service]
Type=simple
ExecStart=/usr/bin/hyprvoice serve
Restart=on-failure
RestartSec=5
Environment=XDG_RUNTIME_DIR=/run/user/%i
[Install]
WantedBy=default.target
+97
View File
@@ -0,0 +1,97 @@
#!/bin/bash
# Complete script to update AUR package after a new release
set -e
if [ $# -ne 1 ]; then
echo "Usage: $0 <version>"
echo "Example: $0 0.1.0"
exit 1
fi
VERSION=$1
AUR_DIR="../hyprvoice-bin"
echo "🚀 Updating AUR package for version $VERSION..."
echo ""
# Check if we're in the packaging directory
if [ ! -f "PKGBUILD" ]; then
echo "❌ Error: PKGBUILD not found. Run this from the packaging/ directory."
exit 1
fi
# Check if AUR directory exists
if [ ! -d "$AUR_DIR" ]; then
echo "❌ Error: AUR directory not found at $AUR_DIR"
echo " Expected structure:"
echo " ├── hyprvoice/ # Main repo"
echo " │ └── packaging/ # You are here"
echo " └── hyprvoice-bin/ # AUR repo"
echo ""
echo " Run the initial AUR setup first."
exit 1
fi
# Update version in PKGBUILD
echo "📝 Updating version to $VERSION..."
sed -i "s/pkgver=.*/pkgver=${VERSION}/" PKGBUILD
# Update checksums
echo "🔐 Updating checksums..."
if ! updpkgsums; then
echo "❌ Error: Failed to update checksums."
echo " Make sure GitHub release v$VERSION exists and is accessible."
exit 1
fi
# Copy files to AUR repo
echo "📋 Copying files to AUR repository..."
cp PKGBUILD "$AUR_DIR/"
cp hyprvoice.service "$AUR_DIR/"
cp hyprvoice.install "$AUR_DIR/"
# Switch to AUR directory
cd "$AUR_DIR"
# Generate .SRCINFO
echo "📄 Generating .SRCINFO..."
makepkg --printsrcinfo > .SRCINFO
# Test build
echo "🔨 Testing package build..."
if ! makepkg --noextract --nodeps; then
echo "❌ Error: Package build failed."
exit 1
fi
echo "✅ Package build successful!"
echo ""
# Show git status
echo "📊 AUR repository status:"
git status --short
echo ""
echo "🚀 Ready to publish to AUR:"
echo " git add ."
echo " git commit -m \"Update to version $VERSION\""
echo " git push origin master"
echo ""
read -p "Push to AUR now? (y/N): " push_confirm
if [[ $push_confirm == [yY] ]]; then
git add .
git commit -m "Update to version $VERSION"
git push origin master
echo ""
echo "🎉 Successfully updated AUR package to v$VERSION!"
echo " AUR page: https://aur.archlinux.org/packages/hyprvoice-bin"
else
echo "📝 To push later:"
echo " cd $AUR_DIR"
echo " git add . && git commit -m \"Update to version $VERSION\" && git push"
fi
echo ""
echo "✅ AUR update complete!"
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
# Helper script to update PKGBUILD after a new release
set -e
if [ $# -ne 1 ]; then
echo "Usage: $0 <version>"
echo "Example: $0 0.1.0"
exit 1
fi
VERSION=$1
echo "Updating PKGBUILD for version $VERSION..."
# Update version in PKGBUILD
sed -i "s/pkgver=.*/pkgver=${VERSION}/" PKGBUILD
# Update checksums
echo "Updating checksums..."
updpkgsums
echo "✅ PKGBUILD updated for version $VERSION"
echo ""
echo "Next steps:"
echo "1. Review the changes: git diff"
echo "2. Test the package: makepkg -si"
echo "3. Commit and push to AUR"