September 2024 Setting up an auto-publishing workflow
A quick note on how I’m syncing Bear with this site, since I haven’t done this before.
I’m using launchd
to update this site the with the most recent content from Bear every minute. Right now, there’s hardly any content here so the inefficiency of re-generating and re-deploying everything is not a problem.
The launchd
bit was a bit prickly to figure out, so I figured I’d write it down here. ChatGPT helped with a lot of the basics. Here are the instructions I ended up with (just pub
is a recipe that uses the excellent Just command runner):
Save this to ~/Library/LaunchAgents/is.yuri.pubcommand.plist
:
Label
is.yuri.pubcommand
StartInterval
60
ProgramArguments
/bin/zsh
-c
just pub
WorkingDirectory
/Users/yurivish/Dropbox/Projects/what
StandardOutPath
/tmp/what_yuri_is_output.log
StandardErrorPath
/tmp/what_yuri_is_error.log
EnvironmentVariables
PATH
/Users/yurivish/.cargo/bin/:/usr/local/go/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
RunAtLoad
Then run:
This will automatically run the publication command every minute, publishing the #pub
notes from Bear.
To temporarily disable the scheduled job, you can unload the plist using launchctl:
This will stop the job from running without deleting the plist file. To re-enable it later, simply load it again:
You can see logs by tail
ing the paths specified in the plist file under StandardOutPath
and StandardErrorPath
.