GitHub Pages is one of the easiest and completely FREE ways to deploy your landing page. It comes with SSL, CDN, and custom domain support—all at zero cost.
- A GitHub account (free)
- Your landing page repository on GitHub
- Built project files in the
distfolder
100% FREE - No credit card required, no limits for static sites.
This method automatically builds and deploys your site whenever you push changes to your repository.
- In your repository, create the directory structure:
.github/workflows/ - Create a file named
deploy.ymlin that folder with this content:
name: Deploy to GitHub Pages
on:
push:
branches:
- main # Change to your default branch if different
permissions:
contents: read
pages: write
id-token: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4- Go to your repository on GitHub
- Click Settings → Pages
- Under "Source", select GitHub Actions
- Click Save
-
Commit the workflow file:
git add .github/workflows/deploy.yml git commit -m "Add GitHub Pages deployment workflow" git push -
GitHub Actions will automatically build and deploy your site
-
Check the Actions tab to see the deployment progress
-
Your site will be live at:
https://yourusername.github.io/repository-name/
If you prefer to build locally and deploy manually:
npm run buildnpm install --save-dev gh-pagesAdd this to your package.json scripts section:
"scripts": {
"deploy": "gh-pages -d dist"
}npm run deploy- Go to Settings → Pages
- Under "Source", select Deploy from a branch
- Select the
gh-pagesbranch - Click Save
Your site will be live at: https://yourusername.github.io/repository-name/
Create a file named CNAME in your src folder (not dist) with your domain:
yourdomain.com
Or with a subdomain:
landing.yourdomain.com
Add these DNS records:
For apex domain (yourdomain.com):
Type: A
Name: @
Value: 185.199.108.153
Type: A
Name: @
Value: 185.199.109.153
Type: A
Name: @
Value: 185.199.110.153
Type: A
Name: @
Value: 185.199.111.153
For subdomain (landing.yourdomain.com):
Type: CNAME
Name: landing
Value: yourusername.github.io
- Go to Settings → Pages
- Enter your custom domain in the "Custom domain" field
- Click Save
- Wait for DNS check to complete (can take up to 48 hours)
- Enable "Enforce HTTPS" once DNS is verified
If you're using client-side routing, create a 404.html file in your src folder that redirects to index.html.
- Check that your
package.jsonhas all required dependencies - Verify Node.js version in workflow matches your development environment
- Review build logs in the Actions tab
- Wait 24-48 hours for DNS propagation
- Use
dig yourdomain.comto check DNS records - Make sure CNAME file is in the root of your deployed branch
- Global CDN: Your site is served from GitHub's CDN
- Free SSL: Automatic HTTPS certificates
- Fast Deployment: Changes go live in 1-2 minutes
- Version Control: Easy rollbacks via Git
- Static sites only (perfect for this landing page!)
- 1GB repository size limit
- 100GB bandwidth per month (very generous)
- 10 builds per hour limit
- Monitor your deployments in the Actions tab
- Set up custom domain for professional branding
- Use GitHub's analytics to track page views (Settings → Traffic)
Cost Summary: $0/month forever Deployment Time: 1-2 minutes per deployment Difficulty: Easy 🟢