ADAM DJ BRETT

Home / Blog / Deploying Jekyll to XMIT

As the year comes to a close I am still working on reducing my hosting bills and exploring using xmit.co for hosting. In the last few days Pierre has refactored the homepage and documentation which makes using the service even easier and more appealing. Today's site that I decided to move over from netlify to xmit uses Jekyll so it was a bit tricky for the move. I havent touched Jekyll in a few months so I was a little out of practice. First I decoupled the site from netlify, updated the DNS ANAME, CNAME, and TXT records to using the DNS Configuration settings. Then I updated the xmity-deploy.yml github action to work for jekyll. the file is below:

name: Deploy Jekyll to XMIT

on:
  push:
    branches: ["main", "master"]
  workflow_dispatch:
    inputs:
      site:
        description: "XMIT site/domain (e.g. example.com)"
        required: true
        type: string

concurrency:
  group: deploy-xmit-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  deploy:
    runs-on: ubuntu-latest
    env:
      # Target site/domain for XMIT deploy
      XMIT_SITE: example.com@268 
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.3'
          bundler-cache: true

      - name: Build Jekyll site
        run: bundle exec jekyll build

      - name: Verify build output
        run: |
          if [ ! -d _site ]; then
            echo "_site directory missing after build" >&2
            exit 1
          fi
          ls -1 _site | head -n 20

      - name: Setup Node.js (for XMIT CLI)
        uses: actions/setup-node@v4
        with:
          node-version: 20

      - name: Deploy to XMIT (CLI)
        env:
          XMIT_KEY: ${{ secrets.XMIT_KEY }}
        run: |
          if [ -z "$XMIT_KEY" ]; then
            echo "XMIT_KEY secret is not set" >&2
            exit 1
          fi
          # Use manual input when workflow_dispatch triggers this workflow
          SITE_INPUT="${{ github.event_name == 'workflow_dispatch' && inputs.site || '' }}"
          if [ -n "$SITE_INPUT" ]; then
            export XMIT_SITE="$SITE_INPUT"
          fi
          if [ -z "$XMIT_SITE" ]; then
            echo "XMIT site/domain not provided. Set repo Variable 'XMIT_SITE' or pass 'site' input." >&2
            exit 1
          fi
          echo "Deploying _site to $XMIT_SITE via XMIT CLI";
          npx -y @xmit.co/xmit "$XMIT_SITE" _site || { echo 'XMIT deploy failed' >&2; exit 1; }

      - name: Post-deploy summary
        run: |
          echo "Deployment attempt finished for $XMIT_SITE";
          echo "Visit: https://$XMIT_SITE";

    # Uncomment below for an alternative raw API upload if you have endpoint details
    # steps:
    #   - name: Deploy via API (curl)
    #     run: |
    #       tar -czf site.tar.gz -C _site .
    #       curl -f -X POST \
    #         -H "Authorization: Bearer $XMIT_KEY" \
    #         -F "[email protected]" \
    #         https://api.xmit.example/deploy?site=$XMIT_SITE

After updating the xmit-deploy.yml file I naively thought that I would be good to go. However that was not the case. Immiediately my github action failed so I had to:

source "https://rubygems.org"

# This will help ensure the proper Jekyll version is running.
gem "jekyll", ">= 4.3.3"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Required for Ruby 3.3+ (Jekyll/kramdown dependency)
gem 'rexml'

group :jekyll_plugins do
  gem 'jekyll-paginate', '1.1.0'
  gem 'jekyll-seo-tag', '>= 2.8.0'
  gem 'jekyll-sitemap', '>= 1.4.0'
  gem 'jekyll-redirect-from', '>= 0.16.0'
  # Remove jekyll-tagsgenerator and jekyll-author-page as they are not maintained for Jekyll 4.x. If you need similar functionality, consider alternatives or custom plugins.
end

I replaced the tag pages with rflog's Automated Jekyll blog tags and that worked nice and easily. I still havent replaced the jekyll-author-page plugin but that is tomorrows problem, I found jetroid's Jekyll Author Pages which seems like a nice gem free alternative.

After these updates to jekyll, I pushed to github and everything is working nicely with the site now living its best life over at xmit.co

Tags : website Jekyll

Previous

XMIT Redirects and 11ty

Using XMIT Redirects on an Eleventy site deploying to XMIT via GitHub Actions

Next

Deploying an Eleventy Site to XMIT using GitHub Actions

using the #indieweb and not the VC web for hosting