Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit c094abb2 authored by Dorian Turba's avatar Dorian Turba
Browse files

Merge branch 'trunk'

parents b4243e41 74da7721
No related branches found
No related tags found
No related merge requests found
Pipeline #41169 passed
[tool.bumpversion]
commit = true
config-file = "pyproject.toml"
current_version = "0.4.5"
current_version = "0.4.6"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
replace = "{new_version}"
search = "{current_version}"
......@@ -22,5 +21,3 @@ search = """## [Unreleased]
[[tool.bumpversion.files]]
allow-dirty = true
filename = "README.md"
replace = "{new_version}"
search = "{current_version}"
......@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.4.6] - 2024-08-02
* Misc updates and improvements for development team
## [0.4.5] - 2024-08-01
* Update documentation
......
......@@ -21,7 +21,7 @@ your instance:
```yaml
include:
- component: $CI_SERVER_FQDN/swepy/cicd-templates/release-by-changelog/release-by-changelog@0.4.5
- component: $CI_SERVER_FQDN/swepy/cicd-templates/release-by-changelog/release-by-changelog@0.4.6
```
[![Supported by GitLab.com](https://img.shields.io/badge/Supported_by-GitLab.com-orange)](https://gitlab.com)
......@@ -31,7 +31,7 @@ As a remote Template if the component is not supported or mirrored by your insta
```yaml
include:
- remote: 'https://gitlab.com/swepy/cicd-templates/release-by-changelog/-/raw/0.4.5/templates/release-by-changelog.yml'
- remote: 'https://gitlab.com/swepy/cicd-templates/release-by-changelog/-/raw/0.4.6/templates/release-by-changelog.yml'
```
### Customize job
......
release_by_changelog:
variables:
CHANGELOG_FILEPATH: 'CHANGELOG.md'
CHANGELOG_FILEPATH: CHANGELOG.md
PREFIX: ''
SUFFIX: ''
TAG_PREFIX: $PREFIX
......@@ -17,52 +17,51 @@ release_by_changelog:
- 'first_line=$(echo "$headers" | head -1 | cut -d: -f1)'
# Check if we have a header, else exit
- 'if [ -z "$first_line" ]; then'
- ' echo "No version headers found."'
- ' exit 1'
- 'fi'
- if [ -z "$first_line" ]; then
- echo "No version headers found."
- exit 1
- fi
# Extract version and date from the first header
- 'version=$(echo "$headers" | head -1 | grep -oE "\[([0-9]+)\.([0-9]+)\.([0-9]+)\]" | tr -d "[]")'
- 'date=$(echo "$headers" | head -1 | grep -oE "[0-9]{4}-[0-9]{2}-[0-9]{2}")'
- version=$(echo "$headers" | head -1 | grep -oE "\[([0-9]+)\.([0-9]+)\.([0-9]+)\]" | tr -d "[]")
- date=$(echo "$headers" | head -1 | grep -oE "[0-9]{4}-[0-9]{2}-[0-9]{2}")
# If date is different from today, format it
- 'if [ "$date" != "$(date +%Y-%m-%d)" ]; then'
- ' formatted_date=$(date -u -d "$date" +"%Y-%m-%dT%H:%M:%SZ")'
- 'fi'
- if [ "$date" != "$(date +%Y-%m-%d)" ]; then
- formatted_date=$(date -u -d "$date" +"%Y-%m-%dT%H:%M:%SZ")
- fi
# Extract second header line number for end of text range
- 'second_line=$(echo "$headers" | sed -n "2p" | cut -d: -f1)'
# Determine end line
- 'if [ -n "$second_line" ]; then'
- ' end_line=$((second_line - 1))'
- 'else'
- ' # If there s no second header, use the end of the file'
- ' end_line=$(wc -l < "$CHANGELOG_FILEPATH")'
- 'fi'
- if [ -n "$second_line" ]; then
- end_line=$((second_line - 1))
- else
# If there's no second header, use the end of the file
- end_line=$(wc -l < "$CHANGELOG_FILEPATH")
- fi
- 'start_line=$((first_line + 2))'
- 'if [ "$start_line" -le "$end_line" ]; then'
- start_line=$((first_line + 2))
- if [ "$start_line" -le "$end_line" ]; then
# Use sed to extract the text between the first and the potential second version header
- ' text=$(sed -n "$start_line,$end_line p" "$CHANGELOG_FILEPATH")'
- ' echo "Text:"'
- ' echo "$text"'
- 'else'
- ' echo "No text to extract, start line exceeds end line."'
- 'fi'
- text=$(sed -n "$start_line,$end_line p" "$CHANGELOG_FILEPATH")
- echo "Text = $text"
- else
- echo "No text to extract, start line exceeds end line."
- fi
# Output the results
- 'echo "Version: $version"'
- 'echo "Date: $date"'
- 'echo "Formatted Date: $formatted_date"'
- 'echo "Text:"'
- 'echo "$text"'
- echo "Version = $version"
- echo "Date = $date"
- echo "Formatted Date = $formatted_date"
- echo "Text:"
- echo "$text"
# Set the tag and name
- 'tag="$TAG_PREFIX$version$TAG_SUFFIX"'
- 'name="$NAME_PREFIX$version$NAME_SUFFIX"'
- tag="$TAG_PREFIX$version$TAG_SUFFIX"
- name="$NAME_PREFIX$version$NAME_SUFFIX"
# Create the release
- 'release-cli create --name "$name" --tag-name "$tag" --description "$text" --released-at "$formatted_date"'
- release-cli create --name "$name" --tag-name "$tag" --description "$text" --released-at "$formatted_date"
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment