Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
Burnett01 committed Apr 18, 2020
0 parents commit 432ec4c
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI Tests

on: [push]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Convert test file to png image
uses: ./
with:
quality: 100
scale: 1.0
src: test/test.drawio
dest: test.png
- name: Convert test file to jpeg image
uses: ./
with:
quality: 100
scale: 1.0
src: test/test.drawio
dest: test.jpeg
- name: Convert test file to svg image
uses: ./
with:
scale: 1.0
src: test/test.drawio
dest: test.svg
- name: Convert test file to pdf
uses: ./
with:
scale: 1.0
src: test/test.drawio
dest: test.pdf
- name: Upload images as artifacts
uses: actions/upload-artifact@v1
with:
name: png
path: test.png
- uses: actions/upload-artifact@v1
with:
name: jpeg
path: test.jpeg
- uses: actions/upload-artifact@v1
with:
name: svg
path: test.svg
- uses: actions/upload-artifact@v1
with:
name: pdf
path: test.pdf
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM burnett0/alpine-drawio-batch

ENTRYPOINT ["sh", "-c", \
"drawio-batch \
--quality ${INPUT_QUALITY} \
--scale ${INPUT_SCALE} \
${INPUT_SRC} ${INPUT_DEST}"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Steven Agyekum <agyekum@posteo.de>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# actions-drawio ![CI Tests](https://github.com/Burnett01/actions-drawio/workflows/CI%20Tests/badge.svg)

Convert draw.io documents to ``jpeg|png|svg|pdf`` using [drawio-batch](https://github.com/languitar/drawio-batch).

This action makes use of the heavily optimized Docker image [(alpine-drawio-batch)](https://github.com/Burnett01/docker-images/tree/alpine-drawio-batch).

---

## Usage

You can run this action by using the ``with:`` block

```yml
steps:
- uses: actions/checkout@v2
- name: Convert digramm to png
uses: Burnett01/actions-drawio@1.0
with:
src: diagramm.drawio
dest: diagramm.png
```
**Inputs**
+ ``quality`` The quality for png & jpeg (eg. 100)
+ ``scale`` The scale (eg. 1.0)
+ ``src`` The source file (eg. input.drawio)
+ ``dest`` The destination file (eg. output.jpeg)
---
## Combinations
You can combine this actions with other ones, such as [upload-artifact](https://github.com/actions/upload-artifact):
```yml
steps:
- uses: actions/checkout@v2
- name: Convert test file to png image
uses: Burnett01/actions-drawio@1.0
with:
src: test.drawio
dest: test.png
- name: Upload image as artifact
uses: actions/upload-artifact@v1
with:
name: png
path: test.png
```
---
## Demo/Tests
Check the Actions tab for a live demo:
[Live Demo](https://github.com/Burnett01/actions-drawio/actions?query=workflow%3A%22CI+Tests%22)
24 changes: 24 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'actions-drawio'
author: 'Burnett01'
description: 'Convert draw.io documents to jpeg|png|svg|pdf.'
inputs:
quality:
description: 'Image quality for png|jpeg'
required: false
default: '100'
scale:
description: 'Scales the output file size for pixel-based output formats'
required: false
default: '1.0'
src:
description: 'Input file'
required: true
dest:
description: 'Output file'
required: true
runs:
using: 'docker'
image: 'Dockerfile'
branding:
icon: 'image'
color: 'gray-dark'
1 change: 1 addition & 0 deletions test/test.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2020-04-18T02:00:30.771Z" agent="5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36" etag="MsOoJ0JZaypzkxEouO14" version="12.9.14" type="device"><diagram name="Page-1" id="3e8102d1-ef87-2e61-34e1-82d9a586fe2e">5Zlbj9o6EMc/DY8H5Q48dtlLj3SOVHWr9jEyjkmsOnbkOFz66TsmTkiwd8VWUNEtWq3iGV/i+f8YX5iEy3L3JFFV/C8ywiaBl+0m4f0kCPwoCCb6z8v2rWW2iFpDLmlmKh0Nz/QHMUbPWBuakXpUUQnBFK3GRiw4J1iNbEhKsR1XWws2HrVCObEMzxgx2/qNZqowVt/zjo6PhOaFGXoeG8cK4e+5FA03402CcH34tO4SdX2Z+nWBMrEdmMKHSbiUQqj2qdwtCdOx7cLWtnt8wdu/tyRcndNg5iVJMosTPI9Wq0WI/zE9bBBrSDeFw4uqfRcc6AF0gMLdtqCKPFcIa88WUABboUoGJR8eD3EgeiQPSv1UdQGLkuLOoaT43sdZN1wLrh5RSZnG5yuRGeLImA0rftQ3XAomJJi44Pqd1pSxzgTR97xkcejTjkw3VSIV2Q1MJlJPRJREyT1UMd5gblTb9zy05e2RkbhDpBjg0RuR4TLv+z5qAw9GnjOlCiypHrgispIUxAkSBoPfZXQDj7l+vGtqyklddy4Yb+B1NDBfa3ftG2RCS3cWE+Yb2TZ2sXLo1EzO8ZV6MziRNwYHhrLACRIHOL3xouDE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