|
| 1 | +name: Generate PlantUML Diagrams |
| 2 | +on: |
| 3 | + push: |
| 4 | + paths: |
| 5 | + - '**.puml' |
| 6 | + branches: |
| 7 | + - master |
| 8 | +jobs: |
| 9 | + ci: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + env: |
| 12 | + UML_FILES: ".puml" |
| 13 | + steps: |
| 14 | + - name: Checkout Source |
| 15 | + uses: actions/checkout@v2 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + - name: Get changed UML files |
| 19 | + id: getfile |
| 20 | + run: | |
| 21 | + git diff-tree -r --no-commit-id --summary ${{ github.sha }} \ |
| 22 | + | awk -F' ' '{ |
| 23 | + # ensure we are not trying to process deleted files |
| 24 | + # only process puml files |
| 25 | + # do not try to process our theme or custom config |
| 26 | + if ( $1 !~ /^delete$/ && $4 ~ /\.puml$/ && $4 !~ /(theme|config)\.puml$/ ) |
| 27 | + { |
| 28 | + # only print the file name and strip newlines for spaces |
| 29 | + printf "::set-output name=files::" "%s ", $4 |
| 30 | + } |
| 31 | + } |
| 32 | + END { print "" } # ensure we do print a newline at the end |
| 33 | + ' |
| 34 | + - name: UML files considered echo output |
| 35 | + run: | |
| 36 | + echo ${{ steps.getfile.outputs.files }} |
| 37 | + - name: Generate SVG Diagrams |
| 38 | + uses: cloudbees/plantuml-github-action@master |
| 39 | + with: |
| 40 | + args: -v -tsvg ${{ steps.getfile.outputs.files }} |
| 41 | + - name: Generate PNG Diagrams |
| 42 | + uses: cloudbees/plantuml-github-action@master |
| 43 | + with: |
| 44 | + args: -v -tpng ${{ steps.getfile.outputs.files }} |
| 45 | + - name: Push Local Changes |
| 46 | + uses: stefanzweifel/git-auto-commit-action@v4.1.2 |
| 47 | + with: |
| 48 | + commit_user_name: "Joerg Schultze-Lutter" |
| 49 | + commit_user_email: "76180229+joergschultzelutter@users.noreply.github.com" |
| 50 | + commit_author: "Joerg Schultze-Lutter <76180229+joergschultzelutter@users.noreply.github.com>" |
| 51 | + commit_message: "Generate SVG and PNG images for PlantUML diagrams" |
| 52 | + branch: ${{ github.head_ref }} |
0 commit comments