Alfred Workflows for Quartz Publishing
Alfred Workflows for Quartz Publishing
Section titled “Alfred Workflows for Quartz Publishing”Automate your Quartz publishing workflow with Alfred. Preview, publish, and stop with single keywords.
What You’ll Build
Section titled “What You’ll Build”Three Alfred workflows for your Quartz site:
| Keyword | Action |
|---|---|
preview | Build and serve site locally at localhost:8080 |
publish | Commit changes and push to GitHub |
stoppreview | Stop the preview server |
Prerequisites
Section titled “Prerequisites”- Alfred with Powerpack — alfredapp.com
- Node.js 18+ —
node --versionshould show v18 or higher - Git —
git --version - Quartz — Already set up with your content
The Publish Script
Section titled “The Publish Script”Create scripts/publish.sh in your Quartz project:
#!/bin/bashset -e
QUARTZ_DIR="$HOME/Developer/mementropy-quartz"LOG_FILE="/tmp/quartz-publish.log"
cd "$QUARTZ_DIR" || exit 1
echo "=== Publish started at $(date) ===" > "$LOG_FILE"
# Build the siteecho "Building site..." | tee -a "$LOG_FILE"npx quartz build >> "$LOG_FILE" 2>&1
# Stage and commitgit add -A >> "$LOG_FILE" 2>&1
if git diff --cached --quiet; then echo "No changes to commit" | tee -a "$LOG_FILE" exit 0fi
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")git commit -m "Publish content - $TIMESTAMP" >> "$LOG_FILE" 2>&1
# Pushecho "Pushing to GitHub..." | tee -a "$LOG_FILE"git push origin main >> "$LOG_FILE" 2>&1
echo "Published successfully" | tee -a "$LOG_FILE"Make it executable:
chmod +x scripts/publish.shAlfred Workflow Setup
Section titled “Alfred Workflow Setup”Preview Workflow
Section titled “Preview Workflow”- Alfred Preferences → Workflows → + → Blank Workflow
- Add Keyword:
preview - Add Run Script:
#!/bin/bashQUARTZ_DIR="$HOME/Developer/mementropy-quartz"PID_FILE="/tmp/quartz-preview.pid"
if [ -f "$PID_FILE" ] && kill -0 $(cat "$PID_FILE") 2>/dev/null; then echo "Preview already running" open "http://localhost:8080" exit 0fi
cd "$QUARTZ_DIR" || exit 1npx quartz build --serve &echo $! > "$PID_FILE"sleep 3open "http://localhost:8080"echo "Preview started at localhost:8080"- Add Post Notification → Connect all components
Publish Workflow
Section titled “Publish Workflow”Same process with keyword publish and script:
#!/bin/bashcd "$HOME/Developer/mementropy-quartz" || exit 1output=$(./scripts/publish.sh 2>&1)if [ $? -eq 0 ]; then echo "Published successfully"else echo "Publish failed - check log"fiStop Preview Workflow
Section titled “Stop Preview Workflow”Keyword stoppreview:
#!/bin/bashPID_FILE="/tmp/quartz-preview.pid"if [ -f "$PID_FILE" ]; then kill $(cat "$PID_FILE") 2>/dev/null rm "$PID_FILE"fipkill -f "quartz build --serve" 2>/dev/nullecho "Preview stopped"Testing
Section titled “Testing”- Type
previewin Alfred → Site opens at localhost:8080 - Make a change to content
- Type
publish→ Check GitHub Actions - Type
stoppreview→ Server stops
See also: Remote Publishing for iPhone/iPad control