This repository includes a GitHub Actions workflow that automatically builds and deploys your Docusaurus documentation to GitHub Pages whenever you push to the main branch.
- Go to your repository on GitHub
- Click on Settings tab
- Scroll down to Pages section in the left sidebar
- Under Source, select GitHub Actions
- Save the settings
Once you push this workflow file to your repository, the deployment will start automatically.
git add .
git commit -m "Add GitHub Pages deployment workflow"
git push origin main- Go to the Actions tab in your GitHub repository
- You should see the "Deploy to GitHub Pages" workflow running
- Once completed, your site will be available at:
https://[username].github.io/[repository-name]
- Automatic Deployment: Triggers on every push to
mainormasterbranch - Manual Deployment: Can be triggered manually from the Actions tab
- Optimized Build: Uses npm caching for faster builds
- Modern GitHub Pages: Uses the latest GitHub Pages deployment actions
- Proper Permissions: Configured with minimal required permissions
- Workflow not running: Make sure GitHub Pages is set to "GitHub Actions" as the source
- Build failures: Check the Actions tab for detailed error logs
- Site not updating: Ensure you're pushing to the correct branch (
mainormaster)
If you want to use a custom domain:
- Add a
CNAMEfile to thestatic/directory with your domain name - Configure your domain's DNS to point to GitHub Pages
- Update your repository settings to use the custom domain
If your site is deployed to a subdirectory (like username.github.io/repo-name), make sure your docusaurus.config.js has the correct baseUrl setting:
module.exports = {
// ...
url: 'https://username.github.io',
baseUrl: '/repo-name/',
// ...
};The workflow is located at .github/workflows/deploy.yml and will:
- Check out your code
- Set up Node.js 18
- Install dependencies with
npm ci - Build the site with
npm run build - Deploy the
build/directory to GitHub Pages
You can also trigger deployment manually:
- Go to the Actions tab
- Select "Deploy to GitHub Pages" workflow
- Click "Run workflow"
- Choose the branch and click "Run workflow"