Prerequisites
- A GitHub account
- Your portfolio code pushed to a GitHub repository
- GitHub Pages enabled for your repository
Repository Setup
Enable GitHub Pages
Navigate to your repository settings on GitHub:
- Go to Settings > Pages
- Under Source, select GitHub Actions
- Save your changes
GitHub Actions Workflow
The portfolio uses an automated deployment workflow located at.github/workflows/deploy.yml. This workflow:
- Triggers on pushes to the
gh-pagesbranch - Can be manually triggered via the Actions tab
- Builds and deploys your site automatically
The workflow uses the official
withastro/action@v4 which automatically handles Node.js setup, dependency installation, and the build process using the astro build command.Deployment Process
Push to the gh-pages branch
The deployment automatically triggers when you push to the
gh-pages branch:Monitor the deployment
- Go to the Actions tab in your GitHub repository
- Click on the latest workflow run
- Watch the build and deploy steps complete
- Once successful, your site will be live
Access your deployed site
Your site will be available at:
https://<username>.github.io/<repository-name>/(default)- Or your custom domain if configured (see Custom Domain)
Build Command
The build process uses the following command defined inpackage.json:
- Compiles your Astro components
- Processes Tailwind CSS styles
- Generates a static site in the
dist/directory - Creates a sitemap (via
@astrojs/sitemapintegration)
Manual Deployment
You can also trigger a deployment manually:Troubleshooting
Build Fails
Common issues:- Missing dependencies: Ensure all dependencies are listed in
package.json - Type errors: Run
npm run check:typeslocally before pushing - Build errors: Test the build locally with
npm run build
Site Not Updating
- Check workflow status: Verify the workflow completed successfully in the Actions tab
- Clear browser cache: Hard refresh your browser (Ctrl+Shift+R or Cmd+Shift+R)
- Verify branch: Ensure you pushed to the correct branch (
gh-pages) - Check Pages settings: Confirm GitHub Pages is set to use GitHub Actions as the source
Permissions Error
If you see a permissions error:- Go to Settings > Actions > General
- Under Workflow permissions, select Read and write permissions
- Enable Allow GitHub Actions to create and approve pull requests
- Re-run the failed workflow
404 Errors on Deployment
If your site shows 404 errors:- Check the site URL: Verify the
siteconfiguration inastro.config.mjsmatches your deployment URL - Base path: If deploying to a subpath (not root), you may need to configure the
baseoption inastro.config.mjs - CNAME file: If using a custom domain, ensure the CNAME file is present (see Custom Domain)
The current configuration sets the site URL to
https://aviv.sh, which indicates a custom domain is being used.