|
| 1 | +"""Configuration template generation for Contiamo Release Please.""" |
| 2 | + |
| 3 | + |
| 4 | +def generate_config_template() -> str: |
| 5 | + """Generate a complete configuration file template with all parameters documented. |
| 6 | +
|
| 7 | + Returns: |
| 8 | + YAML configuration template as a string with inline documentation |
| 9 | + """ |
| 10 | + template = """# Contiamo Release Please Configuration |
| 11 | +# |
| 12 | +# This file defines how conventional commits map to semantic version bumps. |
| 13 | +# For more information, visit: https://github.com/contiamo/contiamo-release-please |
| 14 | +
|
| 15 | +# ============================================================================ |
| 16 | +# REQUIRED CONFIGURATION |
| 17 | +# ============================================================================ |
| 18 | +
|
| 19 | +# REQUIRED: Release rules mapping commit types to version bumps |
| 20 | +# Type: object with major/minor/patch keys containing lists of commit types |
| 21 | +# At least one of major/minor/patch must be defined |
| 22 | +release-rules: |
| 23 | + # Major version bump (x.0.0) - breaking changes |
| 24 | + major: |
| 25 | + - breaking |
| 26 | +
|
| 27 | + # Minor version bump (0.x.0) - new features |
| 28 | + minor: |
| 29 | + - feat |
| 30 | +
|
| 31 | + # Patch version bump (0.0.x) - bug fixes and minor changes |
| 32 | + patch: |
| 33 | + - fix |
| 34 | + - perf |
| 35 | + - chore |
| 36 | + - docs |
| 37 | + - refactor |
| 38 | + - style |
| 39 | + - test |
| 40 | + - ci |
| 41 | +
|
| 42 | +# ============================================================================ |
| 43 | +# OPTIONAL CONFIGURATION (with defaults) |
| 44 | +# ============================================================================ |
| 45 | +
|
| 46 | +# Version prefix (e.g., "v" for v1.2.3, "" for 1.2.3) |
| 47 | +# Type: string |
| 48 | +# Default: "" (no prefix) |
| 49 | +version-prefix: "v" |
| 50 | +
|
| 51 | +# Changelog file path |
| 52 | +# Type: string |
| 53 | +# Default: "CHANGELOG.md" |
| 54 | +changelog-path: "CHANGELOG.md" |
| 55 | +
|
| 56 | +# Source branch to create releases from |
| 57 | +# Type: string |
| 58 | +# Default: "main" |
| 59 | +source-branch: "main" |
| 60 | +
|
| 61 | +# Custom release branch name |
| 62 | +# Type: string |
| 63 | +# Default: "release-please--branches--{source-branch}" (auto-generated) |
| 64 | +# Uncomment to customise: |
| 65 | +# release-branch-name: "release-please--branches--main" |
| 66 | +
|
| 67 | +# Git identity for commits (used when creating release commits) |
| 68 | +# Type: object with user-name and user-email fields |
| 69 | +# Default: shown below |
| 70 | +git: |
| 71 | + # Name to use for git commits |
| 72 | + # Default: "Contiamo Release Bot" |
| 73 | + user-name: "Contiamo Release Bot" |
| 74 | +
|
| 75 | + # Email to use for git commits |
| 76 | + |
| 77 | + |
| 78 | +
|
| 79 | +# Changelog sections - groups commits by type in the changelog |
| 80 | +# Type: list of objects with 'type' and 'section' fields |
| 81 | +# Default: shown below |
| 82 | +changelog-sections: |
| 83 | + - type: feat |
| 84 | + section: Features |
| 85 | + - type: fix |
| 86 | + section: Bug Fixes |
| 87 | + - type: chore |
| 88 | + section: Miscellaneous Changes |
| 89 | + - type: ci |
| 90 | + section: Miscellaneous Changes |
| 91 | + - type: docs |
| 92 | + section: Documentation |
| 93 | + - type: refactor |
| 94 | + section: Code Refactoring |
| 95 | +
|
| 96 | +# Extra files to bump version in (beyond the changelog) |
| 97 | +# Type: list of file configuration objects |
| 98 | +# Default: [] (empty list) |
| 99 | +# |
| 100 | +# Supported file types: |
| 101 | +# - yaml: YAML files (requires yaml-path with JSONPath) |
| 102 | +# - toml: TOML files (requires toml-path with JSONPath) |
| 103 | +# - json: JSON files (requires json-path with JSONPath) |
| 104 | +# - generic: Any text file (requires marker comments in the file) |
| 105 | +# |
| 106 | +# Examples: |
| 107 | +extra-files: [] |
| 108 | + # YAML file example (e.g., Helm charts, Kubernetes manifests): |
| 109 | + # - type: yaml |
| 110 | + # path: charts/myapp/Chart.yaml |
| 111 | + # yaml-path: $.version |
| 112 | + # use-prefix: "v" # Optional: include version prefix in this file |
| 113 | +
|
| 114 | + # TOML file example (e.g., Python pyproject.toml, Rust Cargo.toml): |
| 115 | + # - type: toml |
| 116 | + # path: pyproject.toml |
| 117 | + # toml-path: $.project.version |
| 118 | + # use-prefix: "" # Optional: version prefix for this file |
| 119 | +
|
| 120 | + # JSON file example (e.g., Node.js package.json): |
| 121 | + # - type: json |
| 122 | + # path: package.json |
| 123 | + # json-path: $.version |
| 124 | + # use-prefix: "" # Optional: version prefix for this file |
| 125 | +
|
| 126 | + # Generic file example (any text file with marker comments): |
| 127 | + # - type: generic |
| 128 | + # path: README.md |
| 129 | + # use-prefix: "v" |
| 130 | + # |
| 131 | + # For generic files, add markers in your file: |
| 132 | + # <!--- contiamo-release-please-bump-start ---> |
| 133 | + # Text containing version like: v1.2.3 |
| 134 | + # <!--- contiamo-release-please-bump-end ---> |
| 135 | +
|
| 136 | +# ============================================================================ |
| 137 | +# OPTIONAL CONFIGURATION (no defaults - typically use environment variables) |
| 138 | +# ============================================================================ |
| 139 | +
|
| 140 | +# GitHub authentication for pull request creation |
| 141 | +# Type: object with token field |
| 142 | +# Default: none (uses GITHUB_TOKEN environment variable if not specified) |
| 143 | +# |
| 144 | +# To configure: |
| 145 | +# 1. Create a GitHub personal access token at: |
| 146 | +# https://github.com/settings/tokens |
| 147 | +# 2. Required scopes: |
| 148 | +# - 'repo' (for private repositories) |
| 149 | +# - 'public_repo' (for public repositories) |
| 150 | +# 3. Either set GITHUB_TOKEN environment variable (recommended) or uncomment below: |
| 151 | +# |
| 152 | +# github: |
| 153 | +# token: "ghp_xxx" # GitHub personal access token |
| 154 | +
|
| 155 | +# Azure DevOps authentication for pull request creation |
| 156 | +# Type: object with token field |
| 157 | +# Default: none (uses AZURE_DEVOPS_TOKEN environment variable if not specified) |
| 158 | +# |
| 159 | +# To configure: |
| 160 | +# 1. Create an Azure DevOps personal access token at: |
| 161 | +# https://dev.azure.com/{org}/_usersSettings/tokens |
| 162 | +# 2. Required scopes: |
| 163 | +# - 'Code (Read & Write)' |
| 164 | +# 3. Either set AZURE_DEVOPS_TOKEN environment variable (recommended) or uncomment below: |
| 165 | +# |
| 166 | +# azure: |
| 167 | +# token: "xxx" # Azure DevOps personal access token |
| 168 | +
|
| 169 | +# GitLab authentication for merge request creation |
| 170 | +# Type: object with token field |
| 171 | +# Default: none (uses GITLAB_TOKEN environment variable if not specified) |
| 172 | +# |
| 173 | +# To configure: |
| 174 | +# 1. Create a GitLab personal access token at: |
| 175 | +# Settings → Access Tokens (for gitlab.com) |
| 176 | +# Or: https://{your-gitlab-instance}/-/profile/personal_access_tokens |
| 177 | +# 2. Required scopes: |
| 178 | +# - 'api' (full API access) |
| 179 | +# 3. Either set GITLAB_TOKEN environment variable (recommended) or uncomment below: |
| 180 | +# |
| 181 | +# gitlab: |
| 182 | +# token: "glpat-xxx" # GitLab personal access token |
| 183 | +# |
| 184 | +# Note: Works with both gitlab.com and self-hosted GitLab instances |
| 185 | +""" |
| 186 | + return template |
0 commit comments