.build.yml (2110B)
1 image: ubuntu/24.04 2 packages: 3 - imagemagick 4 # - npm 5 - rsync 6 - ruby 7 sources: 8 - https://git.sr.ht/~dce/davideisinger.com 9 secrets: 10 - 9b440bf5-2785-4ab9-9584-124b9ecd04c4 # decryption key 11 - bea2ece1-a780-44cc-b74b-e96c484f0daf # server IP 12 - a1f811ce-156d-4083-9d6e-110da705a286 # deploy key 13 triggers: 14 - action: email 15 condition: failure 16 to: [email protected] 17 environment: 18 HUGO_VERSION: 0.165.0 19 tasks: 20 # Install Hugo + Bundler, and make all subsequent steps cd into site root 21 - setup: | 22 wget --quiet https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb 23 sudo apt install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb 24 sudo gem install bundler 25 echo 'cd davideisinger.com' >> ~/.buildenv 26 27 # Spellcheck Markdown files 28 # - spelling: | 29 # npx cspell "content/**/*.md" 30 31 # Diff RSS template against Hugo default, make sure only differences are intentional 32 - rss: | 33 curl -s https://raw.githubusercontent.com/gohugoio/hugo/refs/tags/v$HUGO_VERSION/tpl/tplimpl/embedded/templates/rss.xml \ 34 | diff - ./themes/v2/layouts/_default/rss.xml \ 35 | wc -l \ 36 | grep 7 37 38 # Start Ruby server for dithering images 39 - dither: | 40 cd bin/dither 41 sudo bundle install 42 ROOT=~/davideisinger.com/content \ 43 KEY=~/secret.key \ 44 bundle exec rackup -p 4567 -D 45 46 # Build site 47 - hugo: | 48 HUGO_PARAMS_GIT_COMMIT=$(git rev-parse HEAD) \ 49 DITHER_SERVER=http://localhost:4567 \ 50 hugo --minify 51 find public -name "*.enc" -type f -delete 52 find public/elsewhere -name "*.gmi" -type f -delete 53 54 # Sync files to production server 55 - deploy: | 56 if [ "$(git rev-parse main)" != "$(git rev-parse HEAD)" ]; then \ 57 complete-build; \ 58 fi 59 set +x 60 export SERVER_IP=$(cat ~/server_ip.txt) 61 rsync \ 62 --rsh="ssh -o StrictHostKeyChecking=no" \ 63 -v \ 64 -r \ 65 --delete \ 66 public/* \ 67 www-data@$SERVER_IP:/var/www/davideisinger.com \ 68 2>/dev/null 69 set -x