The docmd-io/deploy GitHub Action compiles your documentation site and exposes the generated build artifact path for downstream publishing steps.
Use the Starter Template for new repositories. The standalone GitHub Action is designed for integrating docmd compilation into existing repositories.
Workflow Configuration
Add the action to .github/workflows/docs.yml:
name: Deploy Docs
on:
push:
branches: [main]
permissions:
contents: write
pages: write
id-token: write
jobs:
docs:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: docmd-io/deploy@v1
id: build
- uses: actions/upload-pages-artifact@v3
with:
path: ${{ steps.build.outputs.site-dir }}
- uses: actions/deploy-pages@v4
id: deploy
Reusable Workflow Pattern
For zero-boilerplate setups, reference the hosted reusable workflow:
on:
push:
branches: [main]
jobs:
docs:
uses: docmd-io/deploy/.github/workflows/deploy.yml@v1
Action Inputs & Outputs
Inputs
| Parameter | Type | Default | Technical Description |
|---|---|---|---|
node |
string |
"20" |
Target Node.js engine version for build execution. |
Outputs
| Parameter | Technical Description |
|---|---|
site-dir |
Relative path to the compiled static site output directory (e.g. site/). |
Build Execution Steps
The action executes the following internal workflow:
- Environment Setup: Configures the specified Node.js runtime version.
- Config Auto-Detection: Searches up to 2 directory levels deep for
docmd.config.json,docmd.config.js, ordocmd.config.ts. - Automatic Initialisation: If no configuration is discovered, triggers
npx @docmd/core initautomatically. - Dependency Resolution: Runs
npm ciifpackage.jsonexists; otherwise installs@docmd/coredirectly. - Static Site Build: Triggers
npx @docmd/core buildand captures output directory locations.
GitHub Pages Repository Setup
Configure GitHub Pages to deploy from GitHub Actions:
- Open your repository on GitHub.
- Navigate to Settings → Pages.
- Under Build and deployment → Source, select GitHub Actions.
Subpath & Custom Domain Configuration
Subpath Deployment
GitHub Pages serves project sites under subpaths (https://<username>.github.io/<repository>/). Specify your complete site URL in docmd.config.json:
{
"url": "https://username.github.io/my-repo"
}
docmd extracts the /my-repo/ path prefix automatically and applies it to internal asset references and navigation links.
Custom Domains
To configure a custom domain:
- Add a
CNAMEfile containing your hostname (e.g.docs.example.com) insidedocs/. - Update the
urlproperty indocmd.config.jsonto match your domain. - Configure the custom domain under Settings → Pages → Custom domain.
For production environments, pin your workflow steps to explicit version tags (e.g. uses: docmd-io/deploy@v1.0.0) to guard against unintended breaking changes.