Publishes Markdown files from a GitHub repository to a Confluence space. On every run it creates new pages, updates existing ones, and deletes stale pages that are no longer in the repo — keeping Confluence always in sync with your repository.
- Each folder becomes a Confluence page with a Children Display macro.
- Each
.mdfile becomes a Confluence page with converted HTML content. - Local images are uploaded as page attachments.
- Every published page is tagged with a Confluence content property so the tool can find and clean up its own pages on the next run.
- Docker
- A Confluence Cloud account (free tier works)
- A Confluence space and a parent page to publish under
- Log in to your Atlassian site (e.g.
https://yoursite.atlassian.net) - Create a new Confluence space — note the space key from the URL:
https://yoursite.atlassian.net/wiki/spaces/SPACEKEY/ - Create a page inside that space that will be the parent for all published content — note its numeric page ID from the URL:
https://yoursite.atlassian.net/wiki/spaces/SPACEKEY/pages/123456/My+Page
Go to https://id.atlassian.com/manage-profile/security/api-tokens and create a new token. You will use your email address as the login and this token as the API token.
No config file needed. Everything is passed via environment variables.
Required secrets (Settings → Secrets and variables → Actions):
| Secret | Value |
|---|---|
confluence_login |
Your Atlassian account email |
confluence_api_token |
The API token you created |
Required variables — set directly in the workflow file or as repository variables:
| Variable | Example | Description |
|---|---|---|
CONFLUENCE_URL |
https://yoursite.atlassian.net/wiki/rest/api/ |
REST API base URL |
CONFLUENCE_SPACE |
MYSPACE |
Space key |
CONFLUENCE_PARENT_PAGE_ID |
123456 |
Numeric ID of the parent page |
Optional variables:
| Variable | Default | Description |
|---|---|---|
PUBLISHER_PROPERTY_KEY |
autogenerated-publisher |
Content property key used to tag published pages |
BANNER_REPO_URL |
https://github.com |
Link in the auto-generated banner on each page |
BANNER_PROJECT_NAME |
repository name | Display name in the banner |
Workflow file — copy .github/workflows/publisher.yml into your repo and adjust the env section:
env:
CONFLUENCE_URL: https://yoursite.atlassian.net/wiki/rest/api/
CONFLUENCE_SPACE: MYSPACE
CONFLUENCE_PARENT_PAGE_ID: "123456"
CONFLUENCE_LOGIN: ${{ secrets.confluence_login }}
CONFLUENCE_API_TOKEN: ${{ secrets.confluence_api_token }}
PUBLISHER_MARKDOWN_ROOT: /app/data
PUBLISHER_IMAGES_ROOT: /app/data_imagesMount your Markdown folder and images folder in the publish step:
-v "${{ github.workspace }}/docs:/app/data:ro" \
-v "${{ github.workspace }}/docs_images:/app/data_images:ro" \Copy publisher/config/config.yaml and fill in your values:
confluence_url: https://yoursite.atlassian.net/wiki/rest/api/
confluence_space: MYSPACE
confluence_parent_page_id: 123456
publisher_property_key: autogenerated-publisher
banner_repo_url: https://github.com/your-org/your-repo
banner_project_name: My Project
github_folder_with_md_files: ./data
github_folder_with_image_files: ./data_imagesdocker build -t confluence-publisher .
docker run --rm \
-e CONFLUENCE_URL=https://yoursite.atlassian.net/wiki/rest/api/ \
-e CONFLUENCE_SPACE=MYSPACE \
-e CONFLUENCE_PARENT_PAGE_ID=123456 \
-e CONFLUENCE_LOGIN=you@example.com \
-e CONFLUENCE_API_TOKEN=your-api-token \
-v ./docs:/app/data:ro \
-v ./docs_images:/app/data_images:ro \
confluence-publisherdocker run --rm \
-e CONFLUENCE_URL=https://yoursite.atlassian.net/wiki/rest/api/ \
-e CONFLUENCE_SPACE=MYSPACE \
-e CONFLUENCE_PARENT_PAGE_ID=123456 \
-e CONFLUENCE_LOGIN=you@example.com \
-e CONFLUENCE_API_TOKEN=your-api-token \
confluence-publisher --dry-rundocker run --rm \
-e CONFLUENCE_LOGIN=you@example.com \
-e CONFLUENCE_API_TOKEN=your-api-token \
-v ./publisher/config/config.yaml:/app/publisher/config/config.yaml:ro \
-v ./docs:/app/data:ro \
-v ./docs_images:/app/data_images:ro \
confluence-publisherIf your Confluence instance uses an internal CA, mount the certificate and set REQUESTS_CA_BUNDLE:
-v ./my-ca.crt:/certs/my-ca.crt:ro \
-e REQUESTS_CA_BUNDLE=/certs/my-ca.crtOrganise your Markdown files in folders — the directory structure is mirrored in Confluence:
docs/
├── Getting started.md → page under parent
├── Architecture/ → folder page (Children Display macro)
│ ├── Overview.md → child page
│ └── Components.md → child page
└── Operations/
└── Runbook.md
Images referenced in Markdown are uploaded as attachments to the page:
HTTP/HTTPS image links are left as-is (not uploaded).
docker build -t confluence-publisher .
docker run --rm \
--entrypoint python \
confluence-publisher \
-m unittest discover -s /app/publisher -p "test_*.py" -vThe data_example/ folder contains sample Markdown files demonstrating the supported structure and features. The pipeline in this repository publishes those example files to the demo Confluence space.