Skip to content

Instantly share code, notes, and snippets.

@cn-ml
Last active May 30, 2023 05:14
Show Gist options
  • Save cn-ml/6f61145712a54a55dc1d613b21f88c92 to your computer and use it in GitHub Desktop.
Save cn-ml/6f61145712a54a55dc1d613b21f88c92 to your computer and use it in GitHub Desktop.
.releaserc Schema
{
"title": "ReleaseRC",
"type": "object",
"properties": {
"extends": {
"title": "Extends",
"description": "List of modules or file paths containing a shareable configuration. If multiple shareable configurations are set, they will be imported in the order defined with each configuration option taking precedence over the options defined in a previous shareable configuration.",
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"branches": {
"title": "Branches",
"description": "The branches on which releases should happen.",
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/ReleaseBranch"
},
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/ReleaseBranch"
}
]
}
}
]
},
"repositoryUrl": {
"title": "Repositoryurl",
"description": "The git repository URL.",
"type": "string"
},
"tagFormat": {
"title": "Tagformat",
"description": "The Git tag format used by semantic-release to identify releases. The tag name is generated with Lodash template and will be compiled with the version variable.",
"type": "string"
},
"plugins": {
"title": "Plugins",
"description": "Define the list of plugins to use. Plugins will run in series, in the order defined, for each steps if they implement it.",
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": [
{
"type": "string"
},
{}
]
}
]
}
},
"dryRun": {
"title": "Dryrun",
"description": "The objective of the dry-run mode is to get a preview of the pending release. Dry-run mode skips the following steps: prepare, publish, addChannel, success and fail. In addition to this it prints the next version and release notes to the console.",
"type": "boolean"
},
"ci": {
"title": "Ci",
"description": "Set to false to skip Continuous Integration environment verifications. This allows for making releases from a local machine.",
"type": "boolean"
},
"debug": {
"title": "Debug",
"description": "Output debugging information. This can also be enabled by setting the DEBUG environment variable to semantic-release:*.",
"type": "boolean"
}
},
"definitions": {
"ReleaseBranch": {
"title": "ReleaseBranch",
"type": "object",
"properties": {
"name": {
"title": "Name",
"description": "Name of the branch.",
"type": "string"
},
"prerelease": {
"title": "Prerelease",
"description": "Whether to publish this branch as a prerelease.",
"type": "boolean"
}
},
"required": [
"name"
]
}
}
}
from __future__ import annotations
from typing import Any, Optional, TypeAlias, TypeVar
from pydantic import BaseModel, Field
T = TypeVar("T")
ListOrSingle: TypeAlias = T | list[T]
class ReleaseBranch(BaseModel):
name: str = Field(description="Name of the branch.")
prerelease: Optional[bool] = Field(description="Whether to publish this branch as a prerelease.")
class ReleaseRC(BaseModel):
extends: Optional[ListOrSingle[str]] = Field(description="List of modules or file paths containing a shareable configuration. If multiple shareable configurations are set, they will be imported in the order defined with each configuration option taking precedence over the options defined in a previous shareable configuration.")
branches: Optional[ListOrSingle[str | ReleaseBranch]] = Field(description="The branches on which releases should happen.")
repositoryUrl: Optional[str] = Field(description="The git repository URL.")
tagFormat: Optional[str] = Field(description="The Git tag format used by semantic-release to identify releases. The tag name is generated with Lodash template and will be compiled with the version variable.")
plugins: Optional[list[str | tuple[str, Any]]] = Field(description="Define the list of plugins to use. Plugins will run in series, in the order defined, for each steps if they implement it.")
dryRun: Optional[bool] = Field(description="The objective of the dry-run mode is to get a preview of the pending release. Dry-run mode skips the following steps: prepare, publish, addChannel, success and fail. In addition to this it prints the next version and release notes to the console.")
ci: Optional[bool] = Field(description="Set to false to skip Continuous Integration environment verifications. This allows for making releases from a local machine.")
debug: Optional[bool] = Field(description="Output debugging information. This can also be enabled by setting the DEBUG environment variable to semantic-release:*.")
def main():
ReleaseRC.update_forward_refs()
print(ReleaseRC.schema_json(indent=2))
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment