🚀 Deploy Astro on Cloudflare with GitHub Actions

Deployment blueprint • 2026 • ⚙️ GitHub Actions

Advertisement Space - Google AdSense

Key Features

Zero egress fees with Cloudflare Pages
Automatic preview deployments for pull requests
Built-in SSL and global CDN

📋 Configuration Files

Copy these files into your project:

.github/workflows/deploy.yml
name: Deploy to Cloudflare Pages

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      deployments: write
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'

      - name: Install dependencies
        run: npm ci

      - name: Build
        run: npm run build

      - name: Deploy to Cloudflare Pages
        uses: cloudflare/pages-action@v1
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          projectName: your-project-name
          directory: dist
          gitHubToken: ${{ secrets.GITHUB_TOKEN }}

Configuration Summary

🚀
Framework
Astro
☁️
Cloud Provider
Cloudflare Pages & Workers
⚙️
Deployment Tool
GitHub Actions
💰
Pricing
Free tier generous, zero egress fees, flat-rate pricing

☁️ About Cloudflare Pages & Workers

Edge-first platform with zero egress fees

✓ Best For
Static sites, edge computing, cost-effective CDN, global performance
💰 Pricing
Free tier generous, zero egress fees, flat-rate pricing

Available Services:

Pages - Static Site Hosting
Workers - Edge Computing
R2 - Object Storage (S3-compatible)
D1 - SQLite Database
KV - Key-Value Storage
Durable Objects - Stateful Edge
Stream - Video Streaming
Images - Image Optimization
CDN - Global Network
DNS - Managed DNS

✅ Prerequisites

Make sure you have these ready before starting:

Cloudflare account with Pages enabled
GitHub repository with admin access
Astro project initialized with @astrojs/cloudflare adapter
Node.js 18+ installed locally

🚀 Step-by-Step Implementation

Follow these steps to deploy your Astro application:

  1. 1
    Create a new GitHub repository for your Astro project
  2. 2
    Add CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID to GitHub Secrets
  3. 3
    Create .github/workflows/deploy.yml with the above configuration
  4. 4
    Push to main branch to trigger automatic deployment
  5. 5
    Monitor deployment in GitHub Actions tab

📚 About This Stack

🚀 Astro

Modern static site generator with island architecture

🟠 Cloudflare

Edge-first platform with zero egress fees

⚙️ GitHub Actions

CI/CD automation directly in GitHub

🏷️ Tags & Keywords

Astro Cloudflare Cloudflare Pages & Workers GitHub Actions CI/CD DevOps Infrastructure as Code Astro Deployment Cloudflare Hosting Production Ready 2026

Advertisement Space - Google AdSense