Deploy to GitHub Pages (staging)
We typically ship Astro sites in two phases:
- Staging: default GitHub Pages URL (no custom domain)
- Production: custom domain + HTTPS (see: Switch staging → prod (custom domain))
Goal
Get a working deployment at the default GitHub Pages URL (e.g. https://sitios-agencia-digital.github.io/your-repo/).
Steps (staging)
1) Add the GitHub Actions deploy workflow
We deploy Astro sites via a reusable GitHub Actions workflow maintained here:
In the Astro site repo, add a workflow that calls it (replace your-repo as needed):
name: Deploy Site
on:
push:
branches: [master]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
jobs:
deploy:
uses: Sitios-Agencia-Digital/workflows/.github/workflows/astro-github-pages-deploy.yaml@master
secrets:
GH_PAT: ${{ secrets.GH_PAT }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
AWS_BUCKET_NAME: sabkt-your-repo
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2) Enable GitHub Pages - Repo → Settings → Pages - Build and deployment: GitHub Actions
3) Confirm Astro build config
In astro.config.mjs, ensure site and base are correct for GitHub Pages.
Typical pattern:
site:https://<org>.github.iobase:/<repo>/
Typical staging astro.config.mjs for Sitios (replace your-repo):
import { defineConfig } from "astro/config";
import react from "@astrojs/react";
import yaml from "@rollup/plugin-yaml";
import tailwind from "@astrojs/tailwind";
// https://astro.build/config
export default defineConfig({
site: "https://sitios-agencia-digital.github.io",
base: "/your-repo/",
integrations: [react(), tailwind()],
vite: {
plugins: [yaml()],
},
});
4) Deploy
Push to the branch your workflow deploys from (should be master) and verify the site loads on the GitHub Pages URL.
5) Show and iterate with the client
Share the staging URL with the client and iterate quickly:
- Gather feedback and make changes in short loops.
- Push to
masterto redeploy. - Keep the site on the default GitHub Pages URL until it’s ready to ship to the final domain.