Add auto-release

This commit is contained in:
Ryan Hughes
2025-12-13 19:15:34 -05:00
parent 88a13336c3
commit 42401fa8a1
9 changed files with 181 additions and 0 deletions
+48
View File
@@ -215,3 +215,51 @@ Example: If `aether` depends on `hyprshade`, `hyprshade` is built first.
Packages are only rebuilt if:
- PKGBUILD version is newer than repository version
- Package doesn't exist in production
## Automated Releases
The repository includes a GitHub workflow and systemd services for automated daily releases.
### How It Works
1. **GitHub Action** (6:00 AM UTC): Syncs AUR packages and opens a PR if there are updates
2. **Merge PR**: Review and merge the PR to trigger the release pipeline
3. **check-upstream** (2:00 PM Eastern): Detects the merged changes, pulls them, creates state files
4. **auto-release** (3:00 PM Eastern): If state file exists, runs full release workflow and removes state file on success
State files are stored in `/root/.state/`:
- `.sync-needed-edge`
- `.sync-needed-stable`
### Installation
```bash
# Copy systemd units
cp /root/omarchy-pkgs/systemd/*.service /root/omarchy-pkgs/systemd/*.timer /etc/systemd/system/
# Reload systemd
systemctl daemon-reload
# Enable and start timers
systemctl enable --now omarchy-check-upstream.timer
systemctl enable --now omarchy-auto-release-edge.timer
systemctl enable --now omarchy-auto-release-stable.timer
# Create state directory
mkdir -p /root/.state
```
### Management
```bash
# Check timer status
systemctl list-timers omarchy-*
# Manual trigger
systemctl start omarchy-check-upstream.service
systemctl start omarchy-auto-release-edge.service
# View logs
journalctl -u omarchy-check-upstream.service
journalctl -u omarchy-auto-release-edge.service
```
+49
View File
@@ -0,0 +1,49 @@
#!/bin/bash
# Process sync for a specific mirror if state file exists
# Usage: process-sync <mirror>
# Example: process-sync edge
set -e
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
source "$BUILD_ROOT/helpers/message-helpers.sh"
MIRROR="${1:-}"
STATE_DIR="${OMARCHY_STATE_DIR:-/root/.state}"
if [[ -z "$MIRROR" ]]; then
print_error "Usage: $0 <mirror>"
echo " mirror: edge or stable"
exit 1
fi
if [[ "$MIRROR" != "edge" && "$MIRROR" != "stable" ]]; then
print_error "Invalid mirror: $MIRROR (must be 'edge' or 'stable')"
exit 1
fi
STATE_FILE="$STATE_DIR/.sync-needed-$MIRROR"
print_header "Processing Sync for $MIRROR"
# Check if state file exists
if [[ ! -f "$STATE_FILE" ]]; then
print_info "No sync needed for $MIRROR (state file not found)"
exit 0
fi
print_info "State file found: $STATE_FILE"
print_info "Starting release workflow for $MIRROR..."
# Run the release workflow
if "$BUILD_ROOT/bin/repo" release --mirror "$MIRROR" --skip-prod-check; then
print_success "Release completed successfully for $MIRROR"
# Remove state file on success
rm -f "$STATE_FILE"
print_success "State file removed: $STATE_FILE"
else
print_error "Release failed for $MIRROR"
print_warning "State file retained for retry: $STATE_FILE"
exit 1
fi
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
# Check for upstream changes and create state files if updates were pulled
set -e
REPO_DIR=/root/omarchy-pkgs
STATE_DIR=/root/.state
mkdir -p "$STATE_DIR"
cd "$REPO_DIR"
git fetch origin main --quiet
if [[ $(git rev-parse HEAD) != $(git rev-parse origin/main) ]]; then
git pull --ff-only origin main
touch "$STATE_DIR/.sync-needed-edge"
fi
+13
View File
@@ -0,0 +1,13 @@
[Unit]
Description=Auto-release omarchy-pkgs for edge mirror
After=network-online.target omarchy-check-upstream.service
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=/root/omarchy-pkgs/bin/auto-release edge
Environment=OMARCHY_STATE_DIR=/root/.state
TimeoutStartSec=3600
[Install]
WantedBy=multi-user.target
+10
View File
@@ -0,0 +1,10 @@
[Unit]
Description=Process omarchy-pkgs sync for edge mirror
[Timer]
# Run 30 minutes after the upstream check
OnCalendar=*-*-* 15:00:00 America/New_York
Persistent=true
[Install]
WantedBy=timers.target
@@ -0,0 +1,13 @@
[Unit]
Description=Auto-release omarchy-pkgs for stable mirror
After=network-online.target omarchy-check-upstream.service
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=/root/omarchy-pkgs/bin/auto-release stable
Environment=OMARCHY_STATE_DIR=/root/.state
TimeoutStartSec=3600
[Install]
WantedBy=multi-user.target
+10
View File
@@ -0,0 +1,10 @@
[Unit]
Description=Process omarchy-pkgs sync for stable mirror
[Timer]
# Run 1 hour after the upstream check (after edge has completed)
OnCalendar=*-*-* 15:00:00 America/New_York
Persistent=true
[Install]
WantedBy=timers.target
+13
View File
@@ -0,0 +1,13 @@
[Unit]
Description=Check for upstream changes in omarchy-pkgs repository
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=/root/omarchy-pkgs/bin/check-upstream
Environment=OMARCHY_PKGS_DIR=/root/omarchy-pkgs
Environment=OMARCHY_STATE_DIR=/root/.state
[Install]
WantedBy=multi-user.target
+9
View File
@@ -0,0 +1,9 @@
[Unit]
Description=Daily check for upstream changes in omarchy-pkgs
[Timer]
OnCalendar=*-*-* 14:00:00 America/New_York
Persistent=true
[Install]
WantedBy=timers.target