Overview
The portfolio is configured to deploy automatically to GitHub Pages when you push to themain branch. The deployment workflow builds the site and publishes it to https://juanroccia.github.io.
Prerequisites
Before deploying, ensure:GitHub repository created
Create a repository named
username.github.io (replace username with your GitHub username):Site URL configured
Update Replace
astro.config.mjs with your GitHub Pages URL:astro.config.mjs
juanroccia with your GitHub username.GitHub Actions Workflow
The deployment is automated using this workflow:.github/workflows/deploy.yml
Workflow Breakdown
Triggers
- push: Automatically runs on every push to
main - workflow_dispatch: Allows manual triggering from GitHub Actions tab
Permissions
Build Job
Install dependencies
package-lock.json (faster and more reliable than npm install)Deploy Job
- Waits for
buildjob to complete - Deploys the artifact to GitHub Pages
- Provides deployment URL in workflow output
Initial Setup
Configure GitHub Pages in your repository:Enable GitHub Pages
- Go to repository Settings > Pages
- Under Source, select GitHub Actions
- Save the settings

Deployment Process
Every push tomain triggers:
- Checkout: Repository code is cloned
- Install: Dependencies are installed with
npm ci - Build: Site is built with
npm run build - Deploy: Built files are deployed to GitHub Pages
- Live: Site is available at your GitHub Pages URL
Custom Domain Setup
Use a custom domain instead ofusername.github.io:
Configure DNS
Add DNS records with your domain provider:For www subdomain (recommended):For apex domain:
DNS propagation can take up to 24 hours. Use DNS Checker to verify.
Manual Deployment
Trigger deployment manually:- Go to Actions tab
- Click Deploy to GitHub Pages workflow
- Click Run workflow
- Select
mainbranch - Click Run workflow button
Monitoring Deployments
Check deployment status:Via GitHub Actions
- Navigate to Actions tab
- View workflow runs with status badges:
- ✅ Green: Successful
- ❌ Red: Failed
- 🟡 Yellow: In progress
Via Workflow Badge
Add to README.md:Via Deployments
- Go to repository Settings > Environments
- Click github-pages
- View deployment history and URLs
Troubleshooting
Workflow fails at build step
Workflow fails at build step
Issue: Build errors during
npm run buildSolution:- Run build locally:
npm run build - Fix any content validation errors
- Ensure all frontmatter is valid
- Push fixes to
main
Site shows 404
Site shows 404
Issue: GitHub Pages returns 404 after deploymentSolution:
- Verify
siteURL inastro.config.mjsmatches GitHub Pages URL - Check repository name is
username.github.io - Ensure GitHub Pages is enabled in repository settings
- Wait a few minutes for deployment to propagate
Assets not loading
Assets not loading
Issue: Images or CSS missing in productionSolution:
- Ensure assets are in
public/directory - Use absolute paths:
/assets/image.jpg, notassets/image.jpg - Check
imgpaths in frontmatter - Clear browser cache
Custom domain not working
Custom domain not working
Issue: Custom domain shows error or redirects incorrectlySolution:
- Verify DNS records are correct
- Wait 24h for DNS propagation
- Check
public/CNAMEfile exists and is correct - Ensure
siteURL in config matches custom domain - Verify custom domain in GitHub Pages settings
Workflow permission denied
Workflow permission denied
Issue:
Error: Resource not accessible by integrationSolution:- Go to Settings > Actions > General
- Under Workflow permissions, select Read and write permissions
- Enable Allow GitHub Actions to create and approve pull requests
- Save and re-run workflow
Deployment Checklist
Before deploying:site URL in astro.config.mjs is correct.github/workflows/deploy.yml existsGitHub Pages is enabled in repository settings
GitHub Pages source is set to GitHub Actions
Workflow permissions are configured
Build succeeds locally with
npm run buildAll content validates with
npm run astro checkNext Steps
- Building - Understand the build process
- Configuration - Customize site settings
- GitHub Pages Documentation - Official GitHub Pages docs