From 88c1112aa78c8312c0de419e1008afb35e04c379 Mon Sep 17 00:00:00 2001 From: David Eisinger Date: Tue, 8 Oct 2024 16:05:49 -0400 Subject: [PATCH] Add sourcehut build --- .build.yml | 47 ++++++++++++++++++++++++++++++++++++++++++++ bin/dither/config.ru | 3 +++ 2 files changed, 50 insertions(+) create mode 100644 .build.yml create mode 100644 bin/dither/config.ru diff --git a/.build.yml b/.build.yml new file mode 100644 index 0000000..9c33ca2 --- /dev/null +++ b/.build.yml @@ -0,0 +1,47 @@ +image: ubuntu/24.04 +packages: + - imagemagick + - rsync + - ruby +sources: + - https://git.sr.ht/~dce/davideisinger.com +secrets: + - 9b440bf5-2785-4ab9-9584-124b9ecd04c4 # decryption key + - bea2ece1-a780-44cc-b74b-e96c484f0daf # server IP + - a1f811ce-156d-4083-9d6e-110da705a286 # deploy key +triggers: + - action: email + condition: failure + to: david@davideisinger.com +tasks: + - setup: | + wget --quiet https://github.com/gohugoio/hugo/releases/download/v0.122.0/hugo_extended_0.122.0_linux-amd64.deb + sudo apt install -y ./hugo_extended_0.122.0_linux-amd64.deb + sudo gem install bundler + echo 'cd davideisinger.com' >> ~/.buildenv + - dither: | + cd bin/dither + sudo bundle install + ROOT=~/davideisinger.com/content \ + KEY=~/secret.key \ + bundle exec rackup -p 4567 -D + - hugo: | + source bin/get-last-commit.sh + DITHER_SERVER=http://localhost:4567 hugo --minify + find public -name "*.enc" -type f -delete + - check-branch: | + if [ "$(git rev-parse main)" != "$(git rev-parse HEAD)" ]; then \ + complete-build; \ + fi + - deploy: | + set +x + export SERVER_IP=$(cat ~/server_ip.txt) + rsync \ + --rsh="ssh -o StrictHostKeyChecking=no" \ + -v \ + -r \ + --delete \ + public/* \ + www-data@$SERVER_IP:/var/www/davideisinger.com \ + 2>/dev/null + set -x diff --git a/bin/dither/config.ru b/bin/dither/config.ru new file mode 100644 index 0000000..54656fd --- /dev/null +++ b/bin/dither/config.ru @@ -0,0 +1,3 @@ +require "./dither" + +run Sinatra::Application