Last active
September 13, 2023 02:34
-
-
Save xavierarpa/031bffac8fbb4f2d64594310f3165b91 to your computer and use it in GitHub Desktop.
C# to UML Diagram
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate UML | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
generate-uml: | |
name: 'Generate UML' | |
runs-on: ubuntu-latest | |
env: | |
CODE_PATH: "./Assets/Scripts/" | |
UML_OUTPUT_PATH: "./UML/" | |
UMP_GENERATION_PARAMETERS: -public -createAssociation -allInOne | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Remove old diagrams | |
run: rm -r ${{ env.UML_OUTPUT_PATH }} || true | |
- name: Check if there is code | |
run: | | |
[ -d ${{ env.CODE_PATH }} ] && echo "::set-output name=CODE_EXISTS::true" || true | |
id: check_for_code | |
- uses: actions/setup-dotnet@v1 | |
if: ${{ steps.check_for_code.outputs.CODE_EXISTS == 'true' }} | |
with: | |
dotnet-version: 5.0.x | |
- if: ${{ steps.check_for_code.outputs.CODE_EXISTS == 'true' }} | |
run: dotnet tool install --global PlantUmlClassDiagramGenerator --version 1.2.4 | |
- if: ${{ steps.check_for_code.outputs.CODE_EXISTS == 'true' }} | |
run: dotnet tool restore | |
- name: Create a folder for diagrams | |
if: ${{ steps.check_for_code.outputs.CODE_EXISTS == 'true' }} | |
run: mkdir ${{ env.UML_OUTPUT_PATH }} | |
- name: Generate PlantUML files | |
if: ${{ steps.check_for_code.outputs.CODE_EXISTS == 'true' }} | |
run: puml-gen ${{ env.CODE_PATH }} ${{ env.UML_OUTPUT_PATH }} -dir ${{ env.UMP_GENERATION_PARAMETERS }} | |
- name: Get File names | |
if: ${{ steps.check_for_code.outputs.CODE_EXISTS == 'true' }} | |
run: | | |
echo "::set-output name=UML_FILES::$(find ${{ env.UML_OUTPUT_PATH }} -name "*.puml" | tr '\n' ' ')" | |
id: get_file_names | |
- name: Generate SVG Diagrams | |
if: ${{ steps.check_for_code.outputs.CODE_EXISTS == 'true' }} | |
uses: cloudbees/plantuml-github-action@master | |
with: | |
args: -v -tsvg ${{ steps.get_file_names.outputs.UML_FILES }} | |
- uses: EndBug/[email protected] | |
with: | |
author_name: 'UML Bot' | |
message: 'Generate UML (${{ github.workflow }})' | |
author_email: 41898282+uml-bot[bot]@users.noreply.github.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment