diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9c7e1ccc1c6406f444e68b42bce63e6984b46c68..25dd484ed5a4cc9964e0fae9ff69fe3dd13bb6b3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -114,10 +114,16 @@ create-release: image: registry.gitlab.com/gitlab-org/release-cli:latest rules: - if: $CI_COMMIT_TAG =~ /\d+/ - script: echo "Creating release $CI_COMMIT_TAG" + before_script: + - apk add --update yq envsubst + script: + - echo "Creating release $CI_COMMIT_TAG" + - AVAILABLE_OPENTOFU_VERSIONS=$(yq -r '.spec.inputs.opentofu_version.options | .[] | "- [`" + . + "`](https://github.com/opentofu/opentofu/releases/tag/v" + . + ")"' templates/full-pipeline.yml) + - export AVAILABLE_OPENTOFU_VERSIONS + - cat .gitlab/release-template.md | envsubst > release-notes.md release: tag_name: $CI_COMMIT_TAG - description: "Release $CI_COMMIT_TAG of components repository $CI_PROJECT_PATH" + description: './release-notes.md' old-states: image: alpine:latest diff --git a/.gitlab/release-template.md b/.gitlab/release-template.md new file mode 100644 index 0000000000000000000000000000000000000000..df8c42f767cb4a00f5bff419d6f68c830969bb1c --- /dev/null +++ b/.gitlab/release-template.md @@ -0,0 +1,26 @@ +Release $CI_COMMIT_TAG of components repository $CI_PROJECT_PATH. + +## Usage + +You can use the OpenTofu CI/CD component from the CI/CD catalog using: + +```yaml +include: + - component: gitlab.com/components/opentofu/full-pipeline@$CI_COMMIT_TAG + inputs: + # The version must currently be specified explicitly as an input, + # to find the correctly associated images. # This can be removed + # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved. + version: $CI_COMMIT_TAG + opentofu_version: $LATEST_OPENTOFU_VERSION + +stages: [validate, test, build, deploy, cleanup] +``` + +See the [README.md](README.md) for more usage examples. + +## Available OpenTofu versions + +This release is available with the following OpenTofu versions: + +$AVAILABLE_OPENTOFU_VERSIONS