Deploy Eleventy from GitHub
Automated deployment workflows for Eleventy static sites using GitHub Actions. Deploy to GitHub Pages, FTP servers, or SSH servers with integrated release management and deployment tracking.
Note: For Netlify or Cloudflare Pages, you don't need this repository! Both platforms integrate directly with GitHub and can automatically build and deploy your Eleventy site. See their documentation:
🚀 Deployment Options
- GitHub Pages - Free hosting with automatic SSL
- SSH Server - Deploy to your own server via SSH
- FTP Server - Deploy to traditional web hosting
- Manual Releases - Create tagged GitHub releases for version tracking
📁 Project Structure
.github/
├── actions/ # Reusable GitHub Actions
│ ├── build/ # Build Eleventy site
│ ├── deploy-github-pages/ # Deploy to GitHub Pages
│ ├── deploy-ftp/ # Deploy via FTP
│ ├── deploy-ssh/ # Deploy via SSH
│ └── new-release/ # Create releases
└── workflows/
├── create-release.yml # Manual release creation
├── test.yml # Test builds on pull requests
└── examples/ # Example deployment workflows
├── deploy-github-pages.yml
├── deploy-ftp.yml
└── deploy-ssh.yml
⚡ Quick Start
-
Use this template or fork this repository
-
Add your Eleventy project files to the repository root
-
Choose a deployment method and copy the appropriate workflow file from
.github/workflows/examples/to.github/workflows/:deploy-github-pages.ymlfor GitHub Pagesdeploy-ssh.ymlfor SSH deploymentdeploy-ftp.ymlfor FTP deployment
-
Configure secrets and variables (see Configuration below)
-
Push to main branch to trigger deployment
⚙️ Configuration
GitHub Pages
Setup:
- Enable GitHub Pages in Settings → Pages
- Set source to "GitHub Actions"
Optional Variables:
BUILD_COMMAND- Build command (default:npm run build)PUBLISH_DIR- Build output directory (default:_site)
SSH Deployment
Required Secrets:
SSH_SERVER- Server hostname (e.g.,example.com)SSH_USERNAME- SSH usernameSSH_PRIVATE_KEY- SSH private key content
Required Variables:
SITE_URL- Your website URL (e.g.,https://example.com)SSH_SERVER_DIR- Deploy directory (e.g.,/var/www/html)
Optional Variables:
BUILD_COMMAND- Build command (default:npm run build)PUBLISH_DIR- Build output directory (default:_site)SSH_PORT- SSH port (default:22)SSH_EXCLUDE- Files to exclude (comma separated)
FTP Deployment
Required Secrets:
FTP_SERVER- FTP server hostnameFTP_USERNAME- FTP usernameFTP_PASSWORD- FTP password
Required Variables:
SITE_URL- Your website URL
Optional Variables:
BUILD_COMMAND- Build command (default:npm run build)PUBLISH_DIR- Build output directory (default:_site)FTP_SERVER_DIR- Upload directory (default:/)
Manual Releases
Setup:
- No additional setup required
- Manually trigger via Actions → Create Release
Required Permissions:
- Actions → General → Workflow permissions set to "Read and write permissions"
Optional Variables:
BUILD_COMMAND- Build command (default:npm run build)PUBLISH_DIR- Build output directory (default:_site)
🔧 Features
- Automated deployment on push to main branch
- Manual deployment via GitHub Actions tab
- Deployment tracking with status updates
- Environment management for production deployments
- Automatic releases with version tagging
- Build testing on pull requests
📝 SSH Key Setup
-
Generate SSH key pair:
ssh-keygen -t rsa -b 4096 -C "github-actions" -
Add public key to server's
~/.ssh/authorized_keys -
Add private key content to
SSH_PRIVATE_KEYsecret
🎯 Workflow Triggers
- Push to main - Automatic deployment
- Pull requests - Build testing only
- Manual dispatch - Run workflows manually
All secrets and variables are configured in Settings → Secrets and variables → Actions.
This repository demonstrates modern DevOps practices for static site deployment with GitHub Actions.