Skip to content

Alfred Workflows for Quartz Publishing

Automate your Quartz publishing workflow with Alfred. Preview, publish, and stop with single keywords.

Three Alfred workflows for your Quartz site:

KeywordAction
previewBuild and serve site locally at localhost:8080
publishCommit changes and push to GitHub
stoppreviewStop the preview server
  • Alfred with Powerpackalfredapp.com
  • Node.js 18+node --version should show v18 or higher
  • Gitgit --version
  • Quartz — Already set up with your content

Create scripts/publish.sh in your Quartz project:

#!/bin/bash
set -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 site
echo "Building site..." | tee -a "$LOG_FILE"
npx quartz build >> "$LOG_FILE" 2>&1
# Stage and commit
git add -A >> "$LOG_FILE" 2>&1
if git diff --cached --quiet; then
echo "No changes to commit" | tee -a "$LOG_FILE"
exit 0
fi
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
git commit -m "Publish content - $TIMESTAMP" >> "$LOG_FILE" 2>&1
# Push
echo "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:

Terminal window
chmod +x scripts/publish.sh
  1. Alfred PreferencesWorkflows+Blank Workflow
  2. Add Keyword: preview
  3. Add Run Script:
#!/bin/bash
QUARTZ_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 0
fi
cd "$QUARTZ_DIR" || exit 1
npx quartz build --serve &
echo $! > "$PID_FILE"
sleep 3
open "http://localhost:8080"
echo "Preview started at localhost:8080"
  1. Add Post Notification → Connect all components

Same process with keyword publish and script:

#!/bin/bash
cd "$HOME/Developer/mementropy-quartz" || exit 1
output=$(./scripts/publish.sh 2>&1)
if [ $? -eq 0 ]; then
echo "Published successfully"
else
echo "Publish failed - check log"
fi

Keyword stoppreview:

#!/bin/bash
PID_FILE="/tmp/quartz-preview.pid"
if [ -f "$PID_FILE" ]; then
kill $(cat "$PID_FILE") 2>/dev/null
rm "$PID_FILE"
fi
pkill -f "quartz build --serve" 2>/dev/null
echo "Preview stopped"
  1. Type preview in Alfred → Site opens at localhost:8080
  2. Make a change to content
  3. Type publish → Check GitHub Actions
  4. Type stoppreview → Server stops

See also: Remote Publishing for iPhone/iPad control