diff --git a/README.md b/README.md index ef3afd001726fbe8f66ac108da61365024c05a06..e4cfdcac61f87ffc8fa81b4ede48ecc06363df61 100644 --- a/README.md +++ b/README.md @@ -403,6 +403,7 @@ The release job is bound to the `publish` stage, appears only on production and | Input / Variable | Description | Default value | | ----------------------- | ----------------------------------------------------------------------- | ----------------- | | `release-enabled` / `PYTHON_RELEASE_ENABLED`| Set to `true` to enable the release job | _none_ (disabled) | +| `auto-release-enabled` / `PYTHON_AUTO_RELEASE_ENABLED`| When set the job start automatically on production branch. When not set (default), the job is manual. Note that this behavior also depends on release-enabled being set. | _none_ (disabled) | | `release-next` / `PYTHON_RELEASE_NEXT` | The part of the version to increase (one of: `major`, `minor`, `patch`) | `minor` | | `semrel-release-disabled` / `PYTHON_SEMREL_RELEASE_DISABLED`| Set to `true` to disable [semantic-release integration](#semantic-release-integration) | _none_ (disabled) | | `GIT_USERNAME` | Git username for Git push operations (see below) | _none_ | diff --git a/kicker.json b/kicker.json index 37a7d3cb32376da3768520cc46ef1036d570142b..5528b9b5a188ccc82dbe8c7b93e1c4562011a19f 100644 --- a/kicker.json +++ b/kicker.json @@ -187,6 +187,12 @@ "description": "Manually trigger a release of your code (uses [bumpversion](https://pypi.org/project/bumpversion/))", "enable_with": "PYTHON_RELEASE_ENABLED", "variables": [ + { + "name": "PYTHON_AUTO_RELEASE_ENABLED", + "description": "When set the job start automatically. When not set (default), the job is manual. Note that this behavior also depends on release-enabled being set.", + "type": "boolean", + "advanced": true + }, { "name": "PYTHON_RELEASE_NEXT", "type": "enum", diff --git a/templates/gitlab-ci-python.yml b/templates/gitlab-ci-python.yml index 0464e8807da5e5b0228a83b183e04a59bbb70584..52b0ea4111d08c94cbf7f32b577df44f0235e638 100644 --- a/templates/gitlab-ci-python.yml +++ b/templates/gitlab-ci-python.yml @@ -130,6 +130,10 @@ spec: description: Enable Release type: boolean default: false + auto-release-enabled: + description: When set the job start automatically on production branch. When not set (default), the job is manual. Note that this behavior also depends on release-enabled being set. + type: boolean + default: false publish-enabled: description: Enable Publish Package type: boolean @@ -292,6 +296,7 @@ variables: PYTHON_SBOM_DISABLED: $[[ inputs.sbom-disabled ]] PYTHON_RELEASE_ENABLED: $[[ inputs.release-enabled ]] PYTHON_PUBLISH_ENABLED: $[[ inputs.publish-enabled ]] + PYTHON_AUTO_RELEASE_ENABLED: $[[ inputs.auto-release-enabled ]] PYTHON_BLACK_ENABLED: $[[ inputs.black-enabled ]] PYTHON_ISORT_ENABLED: $[[ inputs.isort-enabled ]] @@ -1387,6 +1392,8 @@ py-release: # exclude if $PYTHON_RELEASE_ENABLED not set - if: '$PYTHON_RELEASE_ENABLED != "true"' when: never + # on production branch: auto if $PYTHON_AUTO_RELEASE_ENABLED set and implicitly $PYTHON_RELEASE_ENABLED set + - if: '$PYTHON_AUTO_RELEASE_ENABLED == "true" && $CI_COMMIT_REF_NAME =~ $PROD_REF' # on production or integration branch: manual, non blocking - if: '$CI_COMMIT_REF_NAME =~ $PROD_REF || $CI_COMMIT_REF_NAME =~ $INTEG_REF' when: manual