davideisinger.com

My personal website
Log | Files | Refs | README

.build.yml (1920B)


      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.168.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       bin/check-rss-template
     34 
     35   # Start Ruby server for dithering images
     36   - dither: |
     37       cd bin/dither
     38       sudo bundle install
     39       ROOT=~/davideisinger.com/content \
     40         KEY=~/secret.key \
     41         bundle exec rackup -p 4567 -D
     42 
     43   # Build site
     44   - hugo: |
     45       HUGO_PARAMS_GIT_COMMIT=$(git rev-parse HEAD) \
     46         DITHER_SERVER=http://localhost:4567 \
     47         hugo --minify
     48       find public -name "*.enc" -type f -delete
     49       find public/elsewhere -name "*.gmi" -type f -delete
     50 
     51   # Sync files to production server
     52   - deploy: |
     53       if [ "$(git rev-parse main)" != "$(git rev-parse HEAD)" ]; then \
     54         complete-build; \
     55       fi
     56       set +x
     57       export SERVER_IP=$(cat ~/server_ip.txt)
     58       rsync \
     59         --rsh="ssh -o StrictHostKeyChecking=no" \
     60         -v \
     61         -r \
     62         --delete \
     63         public/* \
     64         www-data@$SERVER_IP:/var/www/davideisinger.com \
     65         2>/dev/null
     66       set -x