samhuri.net/bake/publish.rb
Sami Samhuri 744b6b1204
Some checks failed
CI / coverage (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / debug (push) Has been cancelled
Split bake.rb into namespaced task files
Tasks are now namespaced by concern: build:*, draft:*, publish:*, quality:*.
bake.rb is reduced to load path setup and the default task.
2026-04-11 13:43:35 -07:00

34 lines
1 KiB
Ruby

PUBLISH_HOST = "mudge".freeze
PRODUCTION_PUBLISH_DIR = "/var/www/samhuri.net/public".freeze
BETA_PUBLISH_DIR = "/var/www/beta.samhuri.net/public".freeze
GEMINI_PUBLISH_DIR = "/var/gemini/samhuri.net".freeze
# Publish to beta/staging server
def beta
call("build:beta")
run_rsync(local_paths: ["www/"], publish_dir: BETA_PUBLISH_DIR, dry_run: false, delete: true)
end
# Publish Gemini capsule to production
def gemini
call("build:gemini")
run_rsync(local_paths: ["gemini/"], publish_dir: GEMINI_PUBLISH_DIR, dry_run: false, delete: true)
end
# Publish to production server
def production
call("build:release")
run_rsync(local_paths: ["www/"], publish_dir: PRODUCTION_PUBLISH_DIR, dry_run: false, delete: true)
call("publish:gemini")
end
private
def run_rsync(local_paths:, publish_dir:, dry_run:, delete:)
command = ["rsync", "-aKv", "-e", "ssh -4"]
command << "--dry-run" if dry_run
command << "--delete" if delete
command.concat(local_paths)
command << "#{PUBLISH_HOST}:#{publish_dir}"
abort "Error: rsync failed." unless system(*command)
end