Deploy beautiful documentation to GitHub Pages with a single step.
Deploy your documentation to GitHub Pages with a single action:
---
name: Deploy Documentation
"on":
push:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- name: Build and deploy documentation
uses: bartTC/microdocs@v1
with:
files: |
README.md
CHANGELOG.md
title: 'My Project'That's it!
- The action automatically deploys to GitHub Pages by default
- Repository URL is automatically set from your GitHub context
- Just enable GitHub Pages (Settings → Pages → Source: GitHub Actions) and push to main
- Create
.github/workflows/deploy-docs.ymlwith the example above - Enable GitHub Pages:
- Go to Settings → Pages
- Under Source, select GitHub Actions
- Push to main - your docs will deploy automatically!
Your documentation will be available at https://<username>.github.io/<repository>/
| Input | Required | Default | Description |
|---|---|---|---|
files |
Yes | - | Markdown files to process (one per line or space-separated) |
title |
No | Auto-detected | Documentation title (extracted from first H1) |
output |
No | index.html |
Output HTML file path |
template |
No | Default template | Path to custom HTML template |
repo-url |
No | Auto-detected | Repository URL (defaults to current GitHub repo) |
deploy |
No | true |
Automatically deploy to GitHub Pages |
artifact-dir |
No | dist |
Directory for deployment artifacts |
- name: Build and deploy documentation
uses: bartTC/microdocs@v1
with:
files: |
README.md
CHANGELOG.md
title: 'My Project'You can specify files as a multiline list or space-separated:
# Multiline (recommended)
files: |
README.md
CHANGELOG.md
CONTRIBUTING.md
CODE_OF_CONDUCT.md
# Or space-separated
files: 'README.md CHANGELOG.md CONTRIBUTING.md'To just build the documentation without deploying:
- name: Build documentation
uses: bartTC/microdocs@v1
with:
files: 'README.md CHANGELOG.md'
title: 'My Project Documentation'
output: 'docs/index.html'
deploy: falseUse your own HTML template:
- name: Build and deploy documentation
uses: bartTC/microdocs@v1
with:
files: |
README.md
CHANGELOG.md
template: 'templates/custom.html'Override the automatic repository URL:
- name: Build and deploy documentation
uses: bartTC/microdocs@v1
with:
files: 'README.md'
repo-url: 'https://github.com/myorg/myrepo'Change where the HTML file is generated:
- name: Build and deploy documentation
uses: bartTC/microdocs@v1
with:
files: 'README.md CHANGELOG.md'
output: 'public/docs.html'Change the directory used for deployment artifacts:
- name: Build and deploy documentation
uses: bartTC/microdocs@v1
with:
files: 'README.md'
artifact-dir: '_site'Here's a complete workflow with all options:
---
name: Deploy Documentation
"on":
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and deploy documentation
uses: bartTC/microdocs@v1
with:
files: |
README.md
CHANGELOG.md
CONTRIBUTING.md
title: 'My Awesome Project'
template: 'templates/custom.html'
output: 'docs/index.html'The action performs these steps:
- Installs uv - Fast Python package installer
- Builds documentation - Converts Markdown files to HTML using microdocs
- Prepares artifacts (if deploy is true) - Copies the generated HTML to the artifact directory
- Configures GitHub Pages (if deploy is true) - Sets up GitHub Pages deployment
- Uploads artifacts (if deploy is true) - Uploads the HTML to GitHub Pages
- Deploys (if deploy is true) - Publishes to GitHub Pages
- Repository: Must be a GitHub repository
- Branch: Typically deployed from
mainormaster - Permissions: The workflow needs
pages: writeandid-token: writepermissions - GitHub Pages: Must be enabled in repository settings with source set to "GitHub Actions"
Make sure you've enabled GitHub Pages in your repository settings:
- Go to Settings → Pages
- Under Source, select GitHub Actions
Ensure your workflow has the correct permissions:
permissions:
contents: read
pages: write
id-token: writeMake sure the file paths are relative to your repository root:
# ✅ Correct
files: 'README.md'
# ❌ Wrong
files: '/README.md'Ensure the template path is relative to your repository root and the file exists:
# ✅ Correct
template: 'templates/custom.html'