This GitHub Action will export Drawio Files based on drawio-export Docker image.
Export draw.io files inside folders tree of
folder/of/drawio/filesto png files using transparent background
uses: rlespinasse/drawio-export-action@v2
with:
path: folder/of/drawio/files
format: png
transparent: true
.github/workflows/drawio-export.yml- Workflow to keep your draw.io export synchronized
name: Keep draw.io export synchronized
on:
push:
branches:
- main
paths:
- "**.drawio"
- .github/workflows/drawio-export.yml
concurrency:
group: drawio-export-${{ github.ref }}
cancel-in-progress: true
jobs:
drawio-export:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Export drawio files to asciidoctor and png files
uses: rlespinasse/drawio-export-action@v2
with:
format: adoc
transparent: true
output: drawio-assets
- name: Get author and committer info from HEAD commit
uses: rlespinasse/git-commit-data-action@v1
if: github.ref == 'refs/heads/main'
- name: Commit changed files
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "docs: sync draw.io exported files"
commit_user_name: "${{ env.GIT_COMMIT_COMMITTER_NAME }}"
commit_user_email: "${{ env.GIT_COMMIT_COMMITTER_EMAIL }}"
commit_author: "${{ env.GIT_COMMIT_AUTHOR }}"
if: github.ref == 'refs/heads/main'Path to the drawio files to export. Default ".".
Exported format. Default "pdf".
Possible values: adoc, md, jpg, pdf, png, svg, vsdx, xml
Exported folder name. Default "export".
Relative from the exported drawio file
A file from
/path/to/file.drawiowill be exported to/path/to/export/file-{page}.{ext}by default.
Remove page suffix when possible (in case of single page file)
Sets the border width around the diagram. Default "0".
Scales the diagram size
Fits the generated image/pdf into the specified width, preserves aspect ratio
Fits the generated image/pdf into the specified height, preserves aspect ratio
crops PDF to diagram size
Includes a copy of the diagram for PNG or PDF
Set transparent background for PNG
Output image quality for JPEG. Default "90".
Uncompressed XML output
Export all pages (for PDF format only)
Embed Fonts in SVG file. Default: "true".
Possible values: true, false
Theme of the exported SVG image. Default: "light".
Possible values: dark, light
Target of links in the exported SVG image. Default: "auto".
Possible values: auto, new-win, same-win
Export mode for this action. Default: auto
Possible values:
- recent export only the changed files since a calculated reference
- previously pushed commit on
pushevent - base commit on
pull requestevent
- previously pushed commit on
- all export all drawio files without any filter
- reference export since the reference from
since-referenceoption - auto will choose the more appropriated mode
- reference if
since-referenceoption is set, - recent if the reference can be calculated,
- all otherwise
- reference if
CAUTION: When using a mode other than all, you need to checkout all the history.
- uses: actions/checkout@v3
with:
fetch-depth: 0Git Reference serving as base for export. Only when action-mode is set to 'reference'.