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 8fe1505e authored by Dorian Turba's avatar Dorian Turba
Browse files

Merge branch 'trunk'

parents 9a910ee9 43f91583
No related branches found
No related tags found
No related merge requests found
Pipeline #34459 failed
include: include:
- remote: 'https://gitlab.com/r2devops/hub/-/raw/template_release@0.5.2/jobs/template_release/template_release.yml' - project: 'swepy/cicd-templates/release-by-changelog'
ref: 'main'
file: 'release-by-changelog.yml'
...@@ -7,7 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -7,7 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
... ## [0.3.0] - 2024-05-12
### Changed
* Do not require Python, use release-cli
### Removed
* venv job
## [0.2.4] - 2024-05-08 ## [0.2.4] - 2024-05-08
......
# Contributing to Release by Changelog
## Useful Commands for Development
This project relies on several commands to manage dependencies and versioning
effectively. Here's a breakdown of the most important commands you should be familiar
with:
### Installation
To set up your environment and install all necessary dependencies:
```sh
pip install --upgrade pip
pip install bump-my-version
```
### Bump version
To bump the version of the project, use the following command:
```sh
bump-my-version bump major
```
```sh
bump-my-version bump minor
```
```sh
bump-my-version bump patch
```
...@@ -15,10 +15,9 @@ Run release_by_changelog on your project. ...@@ -15,10 +15,9 @@ Run release_by_changelog on your project.
## Variables ## Variables
| Name | Description | Default | | Name | Description | Default |
|------------------------|------------------------------------------|----------------------------| |----------------------|----------------------------------------|------------------------------------------------|
| `IMAGE_NAME` | The default name for the docker image. | `"python"` | | `IMAGE_NAME` | The default name for the docker image. | `"registry.gitlab.com/gitlab-org/release-cli"` |
| `IMAGE_TAG` | The default tag for the docker image. | `"latest"` | | `IMAGE_TAG` | The default tag for the docker image. | `"latest"` |
| `IMAGE` | The default docker image name. | `"$IMAGE_NAME:$IMAGE_TAG"` | | `IMAGE` | The default docker image name. | `"$IMAGE_NAME:$IMAGE_TAG"` |
| `PROJECT_PATH` | The path to the project root directory. | `"."` | | `CHANGELOG_FILEPATH` | The path to the CHANGELOG.md file. | `"CHANGELOG.md"` |
| `RELEASE_BY_CHANGELOG` | The command to run release_by_changelog. | `"release_by_changelog"` |
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
allow-dirty = true allow-dirty = true
commit = true commit = true
config-file = "pyproject.toml" config-file = "pyproject.toml"
current_version = "0.2.4" current_version = "0.3.0"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)" parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
replace = "{new_version}" replace = "{new_version}"
search = "{current_version}" search = "{current_version}"
...@@ -20,34 +20,3 @@ replace = """## [Unreleased] ...@@ -20,34 +20,3 @@ replace = """## [Unreleased]
""" """
search = """## [Unreleased] search = """## [Unreleased]
""" """
[tool.hatch.envs.default.scripts]
bump-major = "bump-my-version bump major"
bump-minor = "bump-my-version bump minor"
bump-patch = "bump-my-version bump patch"
install = [
"pip-upgrade",
"pip install bump-my-version toml-sort",
]
pip-upgrade = "pip install --upgrade pip"
toml = "toml-sort --in-place pyproject.toml"
[tool.tomlsort]
check = false
ignore_case = true
in_place = true
no_block_comments = true
no_comments = true
no_footer_comments = true
no_header_comments = true
no_inline_comments = true
no_sort_tables = true
sort_inline_arrays = false
sort_inline_tables = true
sort_table_keys = true
spaces_before_inline_comment = 2
spaces_indent_inline_array = 4
trailing_comma_inline_array = true
[tool.tomlsort.overrides."project"]
table_keys = false
include:
- remote: 'https://lab.frogg.it/swepy/cicd-templates/venv/-/raw/venv@1.0.0/venv.yml'
release_by_changelog_venv:
extends: venv
stage: build
variables:
PYTHON_SETUP: 'pip install release_by_changelog'
VENV_ARTIFACT_NAME: 'release_by_changelog_venv'
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
venv:
rules:
- when: never
release_by_changelog:
variables:
IMAGE_NAME: 'python'
IMAGE_TAG: 'latest'
IMAGE: '$IMAGE_NAME:$IMAGE_TAG'
PROJECT_PATH: '.'
RELEASE_BY_CHANGELOG: 'release_by_changelog'
image: $IMAGE
stage: test
before_script:
- source venv/bin/activate
- echo $PROJECT_PATH # Debug
- cd $PROJECT_PATH
- pwd # Debug
script:
- echo $RELEASE_BY_CHANGELOG # Debug
- $RELEASE_BY_CHANGELOG
needs:
- job: release_by_changelog_venv
artifacts: true
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
release_by_changelog:
variables:
IMAGE_NAME: 'registry.gitlab.com/gitlab-org/release-cli'
IMAGE_TAG: 'latest'
IMAGE: '$IMAGE_NAME:$IMAGE_TAG'
CHANGELOG_FILEPATH: 'CHANGELOG.md'
image: $IMAGE
stage: test
script:
# Use grep to find version headers and store them in a variable
- 'headers=$(grep -nE "^## \[([0-9]+)\.([0-9]+)\.([0-9]+)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?\] - [0-9]{4}-[0-9]{2}-[0-9]{2}$" "$CHANGELOG_FILEPATH")'
# Extract first header line number
- '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'
# 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}")'
- 'formatted_date=$(date -u -d "$date" +"%Y-%m-%dT%H:%M:%SZ")' # This line formats the date
# 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'
# Use sed to extract the text between the first and the potential second version header
- 'text=$(sed -n "$((first_line + 2)),$end_line p" "$CHANGELOG_FILEPATH")'
# Output the results
- 'echo "Version: $version"'
- 'echo "Date: $date"'
- 'echo "Formatted Date: $formatted_date"'
- 'echo "Text:"'
- 'echo "$text"'
# Create the release
- 'release-cli create --name "$version" --tag-name "$version" --description "$text" --released-at "$formatted_date"'
rules:
- 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