# 10up/action-wordpress-plugin-deploy architecture

> Architecture diagram of the GitHub repository 10up/action-wordpress-plugin-deploy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/10up/action-wordpress-plugin-deploy
- Repository: https://github.com/10up/action-wordpress-plugin-deploy

## Overview

##### Project type and purpose
- This is a GitHub Action—a CI/CD tool—that automates deployment of a WordPress plugin to the WordPress.org Subversion repository whenever a Git tag or release is created.

##### Main components
- Developer’s GitHub Repository (source code, action.yml, deploy.sh, examples, workflows)
- GitHub Actions Runner (hosted or self-hosted VM/container that executes the CI job)
- GitHub Actions Workflow (YAML files in .github/workflows)
- Deploy Action (the action’s code: action.yml, deploy.sh, underlying scripts)
- Git Checkout Step (actions/checkout)
- Subversion Repository (WordPress.org plugin repo)
- GitHub Secrets Store (SVN_USERNAME, SVN_PASSWORD)
- Optional Outputs (ZIP artifact, GitHub Release)

##### Relationships and data flow
a. Trigger: Developer pushes a tag or creates a release → GitHub Events Engine.
b. Workflow Dispatch: The matching YAML in .github/workflows fires and provisions a Runner.
c. Checkout: Runner executes actions/checkout@v4 to pull plugin source.
d. Deploy Action: Runner reads inputs (generate-zip, dry-run, SLUG, etc.) and secrets, then runs deploy.sh:
- Applies .distignore or .gitattributes to exclude development files
- Copies or builds files from BUILD_DIR or root
- Connects to WordPress.org SVN using SVN_USERNAME/PASSWORD
- Commits tag contents to SVN trunk and assets directory
e. Optional ZIP: If generate-zip=true, Action zips the SVN trunk and returns zip-path as output.
f. Optional Release Step: Subsequent workflow steps can use zip-path to attach a ZIP to the GitHub release.

##### Architectural patterns and design principles
- Event-driven pipeline: reacts to Git events (tag, release)
- Single responsibility: this Action only handles deployment; build steps or asset updates are delegated to other Actions
- Idempotent, ephemeral runners: each run starts fresh, using versioned Action code
- Extensibility via inputs/outputs for customization (SLUG, ASSETS_DIR, BUILD_DIR)

##### Essential elements
- Clear labels: component names, file paths (e.g., .github/workflows/test.yml, action.yml)
- Code and config files
- Runtime environment (Runner)
- External systems (WordPress.org SVN, GitHub Secrets, GitHub Release)

## Diagram (Mermaid)

```mermaid
flowchart TD
    direction TB

    Event["Git Tag or Release Event"]:::trigger

    subgraph "Developer GitHub Repository"
        direction TB
        RepoRoot["/"]:::repo

        subgraph "Workflows"
            direction TB
            WF1["test.yml"]:::repo
            WF2["release-pull-request.yml"]:::repo
            WF3["close-stale-issues.yml"]:::repo
        end

        subgraph "Deploy Action Code"
            direction TB
            AY["action.yml"]:::repo
            DS["deploy.sh"]:::repo

            subgraph "Examples"
                direction TB
                EX1["deploy-on-pushing-a-new-tag.yml"]:::repo
                EX2["deploy-on-pushing-a-new-tag-and-create-release-with-attached-zip.yml"]:::repo
                EX3["deploy-on-publishing-a-new-release-and-attach-a-zip-file-to-the-release.yml"]:::repo
            end
        end

        README["README.md"]:::repo
        CHANGELOG["CHANGELOG.md"]:::repo
        CONTRIBUTING["CONTRIBUTING.md"]:::repo
        LICENSE["LICENSE"]:::repo
    end

    Runner["GitHub Actions Runner"]:::ci
    Checkout["actions/checkout@v4"]:::ci
    DeployExec["Deploy Action"]:::ci
    SVN["WordPress.org SVN Repository"]:::external
    Secrets["GitHub Secrets Store"]:::repo
    ZIP["ZIP Artifact"]:::optional
    Release["GitHub Release"]:::optional

    Event -->|"triggers workflow"| WF1
    Event -->|"triggers workflow"| WF2
    Event -->|"triggers workflow"| WF3

    WF1 -->|"provisions runner"| Runner
    WF2 -->|"provisions runner"| Runner
    WF3 -->|"provisions runner"| Runner

    Runner -->|"checkout code"| Checkout
    Checkout -->|"run deploy action"| DeployExec

    DeployExec -->|"retrieve secrets"| Secrets
    DeployExec -->|"commit to SVN"| SVN
    DeployExec -->|"generate-zip if enabled"| ZIP

    ZIP -->|"attach to release"| Release

    click RepoRoot "https://github.com/10up/action-wordpress-plugin-deploy/tree/develop//"
    click WF1 "https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/.github/workflows/test.yml"
    click WF2 "https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/.github/workflows/release-pull-request.yml"
    click WF3 "https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/.github/workflows/close-stale-issues.yml"
    click AY "https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/action.yml"
    click DS "https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/deploy.sh"
    click EX1 "https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/examples/deploy-on-pushing-a-new-tag.yml"
    click EX2 "https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/examples/deploy-on-pushing-a-new-tag-and-create-release-with-attached-zip.yml"
    click EX3 "https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/examples/deploy-on-publishing-a-new-release-and-attach-a-zip-file-to-the-release.yml"
    click README "https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/README.md"
    click CHANGELOG "https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/CHANGELOG.md"
    click CONTRIBUTING "https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/CONTRIBUTING.md"
    click LICENSE "https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/LICENSE.md"

    classDef ci fill:#D0E8FF,stroke:#003399
    classDef repo fill:#DFF8E0,stroke:#339900
    classDef external fill:#FFE4B5,stroke:#FF8C00
    classDef optional fill:#F0F0F0,stroke:#666666
    classDef trigger fill:#EAE0FF,stroke:#800080
```
