loading...

Keep your draw.io diagrams in sync inside your repository

rlespinasse profile image Romain Lespinasse Updated on ・1 min read

My Workflow

You have Draw.io diagram files on your repository? You export them manually to have them as images (png, jpg) or pdf?

You can keep your diagrams as exported images (png, jpg) or pdf and keep them synchronized when the diagram files are updated.

Submission Category:

  • Maintainer Must-Haves

Yaml File or Link to Code

Example to keep your draw.io files exported as PNG files with associated Asciidoctor pages.

name: Keep draw.io export synchronized
on:
  push:
    branches:
      - master
    paths:
      - "**.drawio"
      - .github/workflows/drawio-export.yml
jobs:
  drawio-export:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@v2
        with:
          token: ${{ secrets.GH_TOKEN }}

      - name: Export drawio files to asciidoctor and png files
        uses: docker://rlespinasse/drawio-export:<VERSION>
        env:
          DRAWIO_EXPORT_FILEEXT: adoc
          DRAWIO_EXPORT_CLI_OPTIONS: -t
          DRAWIO_EXPORT_FOLDER: drawio-assets

      - name: Get author and committer info from HEAD commit
        uses: rlespinasse/git-commit-data-action@v1.x

      - name: Commit changed files
        uses: stefanzweifel/git-auto-commit-action@v4.1.6
        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 }}"

Additional Resources / Info

Learn more about the drawio-export docker image.

GitHub logo rlespinasse / drawio-export

Export Draw.io diagrams using command line / docker

Draw.io Export

Docker Version Docker Pull

Export Draw.io diagrams using command line / docker


Supported Export formats

  • draw.io export formats

    • jpg

    • pdf

    • png

    • svg

    • vsdx

    • xml

  • drawio-export additional formats

    • adoc - Export in png and create an additional asciidoc file (with support external links).




Installation

docker pull rlespinasse/drawio-export


Usage

Print the available options
docker run -it rlespinasse/drawio-export --help
Simple run with default options
$ cd directory-with-drawio-files
$ docker run -it -v $(pwd):/data rlespinasse/drawio-export
+ export file : ./file1.drawio
++ prepare export folder : ./export
++ cleanup export content : ./export/file1*
++ export page 1 : Page-1
+++ generate pdf file
./file1.drawio -> ./export/file1-Page-1.pdf
++ export page 2 : Page 2
+++ generate pdf file
./file1.drawio -> ./export/file1-Page-2.pdf


Integrations

GitHub Action : Export and commit your draw.io files
.github/workflows/drawio-export.yaml
name: Keep draw.io export synchronized
on
  push
    branches
      - master
    paths
      - "**.drawio"







Contributions welcome

Posted on by:

Discussion

pic
Editor guide