GitHub Action
Draw.io Export Action
This GitHub Action will export Drawio Files based on drawio-export docker image.
Export draw.io files inside folders tree of
folder/of/drawio/files
to 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"
.
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 mode for this action. Default: auto
Possible values:
- recent export only the changed files since a calculated reference
- previously pushed commit on
push
event - base commit on
pull request
event
- previously pushed commit on
- all export all drawio files without any filter
- reference export since the reference from
since-reference
option - auto will choose the more appropriated mode
- reference if
since-reference
option 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: 0
Git Reference serving as base for export. Only when action-mode is set to 'reference'.