GitHub Pages
npx @docmd/core deploy --github-pages generates a ready-to-use GitHub Actions CI/CD workflow file at .github/workflows/deploy.yml. Push it to your repository. GitHub builds and deploys your site automatically on every push to main.
npx @docmd/core deploy --github-pages
This creates .github/workflows/deploy.yml personalised to your project. No manual editing is required.
What Gets Generated
The workflow:
- Checks out your repository.
- Installs Node.js and your project dependencies.
- Installs the exact version of
@docmd/coreused to scaffold the file. - Runs
npx @docmd/core build. - Uploads the output directory as a GitHub Pages artefact.
- Deploys it to GitHub Pages.
Enabling GitHub Pages
Before pushing the workflow, enable GitHub Pages in your repository:
- Go to Settings → Pages.
- Set the Source to GitHub Actions.
Once enabled, every push to main triggers a deployment.
Customising the Workflow
The generated file is plain YAML. Edit it freely. Common changes include:
- Branch: Change
branches: [main]to your default branch name. - Node version: Update
node-version: "20"to match your project. - Build command: The workflow uses
npx @docmd/core buildby default. If you use a custom config file, re-runnpx @docmd/core deploy --github-pages --config your-config.jsonto regenerate.
Custom Domain
After deploying, you can add a custom domain in Settings → Pages → Custom domain. Set the url field in your docmd.config.json to match, then redeploy so sitemaps and canonical tags remain correct.