Add Java #5
Workflow file for this run
This file contains 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 - Documentation | |
on: | |
push: | |
branches: [ "main", "docs/**" ] | |
jobs: | |
generate-diagram: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- uses: hashicorp/setup-terraform@v3 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' # See 'Supported distributions' for available options | |
java-version: '21' | |
- name: Install Structurizr CLI | |
run: | | |
curl -L https://github.com/structurizr/cli/releases/latest/download/structurizr-cli.zip -o structurizr-cli.zip | |
unzip structurizr-cli.zip -d structurizr-cli | |
chmod +x structurizr-cli/structurizr.sh | |
sudo mv structurizr-cli/structurizr.sh /usr/local/bin/structurizr | |
- name: Install Terraform Docs | |
env: | |
TERRAFORM_DOCS_VERSION: 0.18.0 | |
run: | | |
wget https://github.com/terraform-docs/terraform-docs/releases/download/v${{ env.TERRAFORM_DOCS_VERSION }}/terraform-docs-v${{ env.TERRAFORM_DOCS_VERSION }}-linux-amd64.tar.gz | |
tar -xvf terraform-docs-v${{ env.TERRAFORM_DOCS_VERSION }}-linux-amd64.tar.gz terraform-docs | |
sudo mv terraform-docs /usr/local/bin/ | |
rm terraform-docs-v${{ env.TERRAFORM_DOCS_VERSION }}-linux-amd64.tar.gz | |
- name: Terraform fmt | |
id: fmt | |
working-directory: ./src/infrastructure/terraform | |
run: terraform fmt -recursive | |
- name: Generate TF Documentation | |
run: terraform-docs markdown table src/infrastructure/terraform --output-file ../../../docs/architecture/Terraform.md | |
- name: Pull Structurizr Workspace DSL | |
env: | |
STRUCTURIZR_WORKSPACE_ID: ${{ secrets.STRUCTURIZR_WORKSPACE_ID }} | |
STRUCTURIZR_API_KEY: ${{ secrets.STRUCTURIZR_API_KEY }} | |
STRUCTURIZR_API_SECRET: ${{ secrets.STRUCTURIZR_API_SECRET }} | |
run: | | |
curl -u "$STRUCTURIZR_API_KEY:$STRUCTURIZR_API_SECRET" \ | |
-o workspace.dsl \ | |
"https://api.structurizr.com/workspace/$STRUCTURIZR_WORKSPACE_ID/dsl" | |
- name: Convert DSL to PlantUML | |
working-directory: ./docs | |
run: | | |
structurizr export -workspace workspace.dsl -format plantuml | |
mkdir -p images | |
mv workspace.puml /images | |
- name: Generate Multiple PNGs | |
working-directory: ./docs/images | |
run: | | |
split -p "@startuml" workspace.puml puml_ | |
for file in puml_*; do | |
echo "@startuml" | cat - "$file" > temp && mv temp "$file" | |
echo "@enduml" >> "$file" | |
filename=$(echo "$file" | sed 's/puml_/diagram_/').png | |
cat "$file" | docker run --rm -i think/plantuml > "$filename" | |
rm "$file" | |
done | |
rm workspace.puml | |
- name: Commit and Push Diagram | |
run: | | |
git config --global user.name "Documentation Bot" | |
git config --global user.email "[email protected]" | |
git add diagram.png | |
git commit -am "Update Structurizr diagrams" | |
git push |