diff --git a/.gitlab/README.md.template b/.gitlab/README.md.template index e6fd8819a7fa7e212053ad2b046cc574a452c090..2a9d0ad46904055469504984e87fbf08b3485c61 100644 --- a/.gitlab/README.md.template +++ b/.gitlab/README.md.template @@ -208,7 +208,8 @@ plan: ## Releases & Versioning This project currently releases tagged commits. -An overview of releases can be found on the [Releases page](https://gitlab.com/components/opentofu/-/releases). +An overview of releases can be found on the [Releases page](https://gitlab.com/components/opentofu/-/releases) +and a Changelog can be found [here](CHANGELOG.md). Each release is accessible in the [CI/CD Catalog](https://gitlab.com/explore/catalog). diff --git a/.gitlab/changelog_config.yml b/.gitlab/changelog_config.yml new file mode 100644 index 0000000000000000000000000000000000000000..67b3993d24d7ee341fb72d1c82de8f7f80f310cb --- /dev/null +++ b/.gitlab/changelog_config.yml @@ -0,0 +1,14 @@ +# See https://docs.gitlab.com/ee/user/project/changelogs.html +# For API see https://docs.gitlab.com/ee/api/repositories.html#add-changelog-data-to-a-changelog-file + +# Defines the category mapping for the markdown rendering +# trailer -> display name in markdown +categories: + added: Added + fixed: Fixed + changed: Changed + deprecated: Deprecated + removed: Removed + security: Security + performance: Performance + other: Other diff --git a/.gitlab/release-notes.md.template b/.gitlab/release-notes.md.template index 941e0078175e70915fee6e2a524b721f97522cb5..f7ce60fd80a17d80d77abd27fd575bfcf2ca86dc 100644 --- a/.gitlab/release-notes.md.template +++ b/.gitlab/release-notes.md.template @@ -1,5 +1,7 @@ Release $CI_COMMIT_TAG of components repository $CI_PROJECT_PATH. +See the [CHANGELOG](CHANGELOG.md) for what changes happened in this release. + ## Usage You can use the OpenTofu CI/CD component from the CI/CD catalog using: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5c6e7415278d1bfdb5f6bfd9d0e45c936726bec9..fd3b1ced7f470e41faf062c01fb10d509f02ed1f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,3 +29,9 @@ That is, they are not bundled and it's not possible to use a component across in The OpenTofu CI/CD job and pipeline templates can be generated using `make backports`. The output is generated into the `backports` folder. Please contribute those files only upon full manual inspection to the canonical GitLab repository. + +## Releasing + +Use the `make release` command with the `VERSION` argument set to the +version of the new release, like: `make release VERSION=1.0.0`. +The version must adhere to the [Semantic Versioning](https://semver.org) format. diff --git a/Makefile b/Makefile index 5620bef1039266348dba42370a90375b3a41b418..9fa6cf45a698fade39d550a6acddd4a2de20447d 100644 --- a/Makefile +++ b/Makefile @@ -50,3 +50,17 @@ backports: @yq e 'del(.*.variables | select(length==0))' $(BACKPORTS_BASE_FILE) | diff -Bw $(BACKPORTS_BASE_FILE) - | patch $(BACKPORTS_BASE_FILE) - @echo "Generated $(BACKPORTS_BASE_FILE)" + +.PHONY: release +release: + @echo -n $(VERSION) | ./.gitlab/scripts/check-semantic-version.sh + @[ "main" = "$(shell git rev-parse --abbrev-ref HEAD)" ] || echo "Please checkout the main branch first: git checkout main" + @echo "Creating changelog ..." + @curl --method POST --header "PRIVATE-TOKEN: $GITLAB_TOKEN" 'https://gitlab.com/api/v4/projects/components%2Fopentofu/repository/changelog' --data "version=$(VERSION)&message='Add changelog for $(VERSION) [skip ci]'" + @echo "Pulling changelog ..." + @git pull + @echo "Tagging $(VERSION) ..." + @git tag $(VERSION) + @echo "Pushing tag $(VERSION) ..." + @git push origin $(VERSION) + @echo "Created tag $(VERSION), pipeline triggered, release will be available soon!" diff --git a/README.md b/README.md index d5e80dfc10f3814a1d156d1da258b9aedf2c41ac..7784f24682a610f34584308e7d3d324b835e2865 100644 --- a/README.md +++ b/README.md @@ -231,7 +231,8 @@ plan: ## Releases & Versioning This project currently releases tagged commits. -An overview of releases can be found on the [Releases page](https://gitlab.com/components/opentofu/-/releases). +An overview of releases can be found on the [Releases page](https://gitlab.com/components/opentofu/-/releases) +and a Changelog can be found [here](CHANGELOG.md). Each release is accessible in the [CI/CD Catalog](https://gitlab.com/explore/catalog).