Local workflows are workflows that are run locally on your machine.
Requirements:
- Project directory set in settings.
- Workflow files are to be place in .teardown/workflows
- Workflow files are to be named like
workflow.json
- Workflow have a JSON schema that can be used to validate the workflow.
Example workflow:
Build workflow:
{
"$schema": "../.teardown/workflows/local-workflow.json",
"id": "build",
"name": "Local Build",
"description": "Local build workflow for the application",
"type": "BUILD",
"trigger": ["MANUAL"],
"steps": [
{
"name": "Build",
"run": "bun",
"args": ["run", "build"],
},
{
"name": "Tag build",
"run": "git",
"args": ["tag", "build/local/$BUILD_NUMBER", "origin"],
"always_run": true
}
]
}
Prepare workflow:
{
"$schema": "../.teardown/workflows/local-workflow.json",
"id": "prepare",
"name": "Local Prepare",
"description": "Local prepare workflow for code quality checks and testing",
"type": "PREPARE",
"trigger": ["MANUAL"],
"steps": [
{
"name": "Bump Version",
"run": "bun",
"args": ["run", "./scripts/bump-version.ts"]
}
]
}
name
: The name of the step.run
: The command to run.args
: The arguments to pass to the command.cwd
: The working directory inside the project directory to run the command in. By default it is the project directory.always_run
: Whether the step should always run if any previous steps failed. By default it is false.
Place this as a new file somewhere in the project directory. Suggestion is to place it in .teardown/workflows
as local-workflow.json
.
If you use a different name, you need to update the $schema
in the workflow file.
Schema:
{
"$ref": "#/definitions/local-workflow",
"definitions": {
"local-workflow": {
"type": "object",
"properties": {
"$schema": {
"type": "string"
},
"id": {
"type": "string",
"minLength": 1
},
"name": {
"type": "string",
"minLength": 1
},
"description": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"PREPARE",
"BUILD",
"TEST",
"DEPLOY"
],
"default": "PREPARE"
},
"trigger": {
"type": "array",
"items": {
"type": "string",
"enum": [
"MANUAL",
"FILE_CHANGE",
"SCHEDULED"
]
},
"default": [
"MANUAL"
]
},
"env": {
"type": "object",
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": [
"number",
"boolean"
]
}
]
}
},
"steps": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"run": {
"type": "string",
"enum": [
"sh",
"git",
"sleep",
"ls",
"pwd",
"echo",
"chsh",
"brew",
"which",
"bun",
"npm",
"node",
"pnpm",
"yarn"
]
},
"args": {
"type": "array",
"items": {
"type": "string"
}
},
"env": {
"type": "object",
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": [
"number",
"boolean"
]
}
]
}
},
"cwd": {
"type": "string"
},
"always_run": {
"type": "boolean"
}
},
"required": [
"name",
"run"
],
"additionalProperties": false
},
"minItems": 1
}
},
"required": [
"$schema",
"id",
"name",
"steps"
],
"additionalProperties": false
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}