├── .github └── workflows │ ├── release.yml │ └── test.yml ├── LICENSE ├── README.md ├── action.yml ├── package.json └── tests ├── doc ├── adr │ ├── 0001-record-architecture-decisions.md │ └── 0002-implement-as-unix-shell-scripts.md └── docs │ └── example.md └── workspace.dsl /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' 7 | 8 | 9 | jobs: 10 | build: 11 | name: Create Release 12 | runs-on: ubuntu-latest 13 | steps: 14 | 15 | - name: Checkout code 16 | uses: actions/checkout@v2 17 | with: 18 | fetch-depth: 0 19 | 20 | - name: Changelog 21 | uses: scottbrenner/generate-changelog-action@master 22 | id: Changelog 23 | env: 24 | REPO: ${{ github.repository }} 25 | 26 | - name: Create Release 27 | id: create_release 28 | uses: actions/create-release@latest 29 | env: 30 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 31 | with: 32 | tag_name: ${{ github.ref }} 33 | release_name: ${{ github.ref }} 34 | body: | 35 | ${{ steps.Changelog.outputs.changelog }} 36 | draft: false 37 | prerelease: false 38 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | on: [push] 3 | 4 | jobs: 5 | structurizr-cli: 6 | runs-on: ubuntu-latest 7 | name: Run structurizr-cli 8 | steps: 9 | 10 | - name: Checkout 11 | uses: actions/checkout@v2 12 | 13 | - name: Run structurizr-cli action 14 | uses: ./ 15 | id: test 16 | with: 17 | id: ${{ secrets.STZR_ID }} 18 | key: ${{ secrets.STZR_API_KEY }} 19 | secret: ${{ secrets.STZR_API_SECRET }} 20 | workspace: ./tests/workspace.dsl 21 | url: https://api.structurizr.com 22 | merge: false 23 | archive: false 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Maksim Milykh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![test](https://github.com/aidmax/structurizr-cli-action/workflows/test/badge.svg) 2 | 3 | # structurizr-cli GitHub Action 4 | 5 | This GitHub action allows you to run [structurizr-cli](https://github.com/structurizr/cli), a command line utility for [Structurizr](https://structurizr.com/) that lets you create software architecture models based upon the [C4 model](https://c4model.com/) using a textual [domain specific language (DSL)](https://github.com/structurizr/dsl). 6 | 7 | Currently, the action supports the following functionality: 8 | 9 | - __Push__ content to a Structurizr workspace (the cloud service or an on-premises installation) 10 | - A model and views defined using the [Structurizr DSL](https://github.com/structurizr/dsl) 11 | - Markdown/AsciiDoc documentation 12 | - Architecture Decision Records (ADRs) 13 | 14 | ## Usage 15 | 16 | To use the action simply create an `structurizr-cli.yml` (or choose custom `*.yml` name) in the `.github/workflows/` directory. 17 | 18 | For example: 19 | 20 | ```yaml 21 | name: sctructurizr-cli # feel free to pick your own name 22 | 23 | on: [push, pull_request] 24 | 25 | jobs: 26 | structurizr-cli: 27 | runs-on: ubuntu-latest 28 | name: Run structurizr-cli 29 | steps: 30 | 31 | - name: Checkout 32 | uses: actions/checkout@v2 33 | 34 | - name: Run structurizr-cli action 35 | uses: aidmax/structurizr-cli-action@v1 36 | id: test 37 | with: 38 | id: # The workspace ID (required) 39 | key: # The workspace API key (required) 40 | secret: # The workspace API secret (required) 41 | workspace: # The path to the workspace JSON file/DSL file(s) (required) 42 | 43 | # optional parameters 44 | url: # The Structurizr API URL (optional; defaults to https://api.structurizr.com) 45 | passphrase: # The passphrase to use (optional; only required if client-side encryption enabled on the workspace) 46 | merge: # Whether to merge layout information from the remote workspace (optional: defaults to true) 47 | archive: # Whether to store the previous version of the remote workspace (optional; default to true) 48 | ``` 49 | 50 | ## Details 51 | 52 | This action is based upon the Dockerfile created and maintained here 53 | 54 | ## License 55 | 56 | The Dockerfile and associated scripts and documentation in this project are released under the [MIT](license). 57 | 58 | ## Credits 59 | 60 | The initial GitHub action has been created by [Maksim Milykh](https://github.com/aidmax). 61 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'structurizr-cli-action' 2 | description: 'Runs structurizr command line application' 3 | author: 'Maksim Milykh' 4 | branding: 5 | icon: 'copy' 6 | color: 'blue' 7 | inputs: 8 | id: 9 | description: 'The workspace ID (required)' 10 | required: true 11 | key: 12 | description: 'The workspace API key (required)' 13 | required: true 14 | secret: 15 | description: 'The workspace API secret (required)' 16 | required: true 17 | workspace: 18 | description: 'The path to the workspace JSON file/DSL file(s) (required)' 19 | required: true 20 | docs: 21 | description: 'The path to the directory containing Markdown/AsciiDoc files to be published (optional)' 22 | required: false 23 | adrs: 24 | description: 'The path to the directory containing ADRs (optional)' 25 | required: false 26 | url: 27 | description: 'The Structurizr API URL (optional; defaults to https://api.structurizr.com)' 28 | required: false 29 | default: 'https://api.structurizr.com' 30 | passphrase: 31 | description: 'The passphrase to use (optional; only required if client-side encryption enabled on the workspace)' 32 | required: false 33 | merge: 34 | description: 'Whether to merge layout information from the remote workspace (optional: defaults to true)' 35 | required: false 36 | archive: 37 | description: 'Whether to store the previous version of the remote workspace (optional; default to true)' 38 | required: false 39 | runs: 40 | using: 'docker' 41 | image: 'docker://ghcr.io/aidmax/structurizr-cli-docker:latest' 42 | args: 43 | - 'push' 44 | - '-id' 45 | - ${{ inputs.id }} 46 | - '-key' 47 | - ${{ inputs.key }} 48 | - '-secret' 49 | - ${{ inputs.secret }} 50 | - '-workspace' 51 | - ${{ inputs.workspace }} 52 | - '-url' 53 | - ${{ inputs.url }} 54 | - '-passphrase' 55 | - ${{ inputs.passphrase }} 56 | - '-merge' 57 | - ${{ inputs.merge }} 58 | - '-archive' 59 | - ${{ inputs.archive }} 60 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /tests/doc/adr/0001-record-architecture-decisions.md: -------------------------------------------------------------------------------- 1 | # 1. Record architecture decisions 2 | 3 | Date: 2020-11-25 4 | 5 | ## Status 6 | 7 | Accepted 8 | 9 | ## Context 10 | 11 | We need to record the architectural decisions made on this project. 12 | 13 | ## Decision 14 | 15 | We will use Architecture Decision Records, as [described by Michael Nygard](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions). 16 | 17 | ## Consequences 18 | 19 | See Michael Nygard's article, linked above. For a lightweight ADR toolset, see Nat Pryce's [adr-tools](https://github.com/npryce/adr-tools). 20 | -------------------------------------------------------------------------------- /tests/doc/adr/0002-implement-as-unix-shell-scripts.md: -------------------------------------------------------------------------------- 1 | # 2. Implement as Unix shell scripts 2 | 3 | Date: 2020-11-25 4 | 5 | ## Status 6 | 7 | Accepted 8 | 9 | ## Context 10 | 11 | The issue motivating this decision, and any context that influences or constrains the decision. 12 | 13 | ## Decision 14 | 15 | The change that we're proposing or have agreed to implement. 16 | 17 | ## Consequences 18 | 19 | What becomes easier or more difficult to do and any risks introduced by the change that will need to be mitigated. 20 | -------------------------------------------------------------------------------- /tests/doc/docs/example.md: -------------------------------------------------------------------------------- 1 | ## Section Title 2 | -------------------------------------------------------------------------------- /tests/workspace.dsl: -------------------------------------------------------------------------------- 1 | workspace "Getting Started" "This is a model of my software system." { 2 | 3 | !adrs doc/adr 4 | !docs doc/docs 5 | 6 | model { 7 | user = person "User" "A user of my software system." 8 | softwareSystem = softwareSystem "Software System" "My software system." 9 | 10 | user -> softwareSystem "Uses" 11 | } 12 | 13 | views { 14 | systemContext softwareSystem "SystemContext" "An example of a System Context diagram." { 15 | include * 16 | autoLayout 17 | } 18 | 19 | styles { 20 | element "Software System" { 21 | background #1168bd 22 | color #ffffff 23 | } 24 | element "Person" { 25 | shape person 26 | background #08427b 27 | color #ffffff 28 | } 29 | } 30 | } 31 | 32 | } 33 | --------------------------------------------------------------------------------