Skip to content

Commit d2f8f02

Browse files
authored
Merge pull request #53 from RustyRory/feature/9-mld
docs(data): Fixes #9 - Ajout MLD
2 parents 7e0bc8e + 8cb2b53 commit d2f8f02

8 files changed

Lines changed: 692 additions & 212 deletions

File tree

.github/workflows/branch-name.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919
FEATURE_REGEX="^(feat|feature)/[0-9]+-[a-z0-9-]+$"
2020
FIX_REGEX="^fix/[0-9]+-[a-z0-9-]+$"
2121
HOTFIX_REGEX="^hotfix/[0-9]+-[a-z0-9-]+$"
22-
RELEASE_REGEX="^release/[0-9]+\.[0-9]+\.[0-9]+$"
2322
2423
if [[ $BRANCH =~ $FEATURE_REGEX ]]; then
2524
echo "✅ Nom de la branche valide (feature)"
@@ -30,16 +29,12 @@ jobs:
3029
elif [[ $BRANCH =~ $HOTFIX_REGEX ]]; then
3130
echo "✅ Nom de la branche valide (hotfix)"
3231
exit 0
33-
elif [[ $BRANCH =~ $RELEASE_REGEX ]]; then
34-
echo "✅ Nom de la branche valide (release)"
35-
exit 0
3632
else
3733
echo "❌ Nom de la branche invalide: $BRANCH"
3834
echo ""
3935
echo "Le nom de la branche doit suivre la convention :"
4036
echo " feature/<issue-id>-description"
4137
echo " fix/<issue-id>-description"
4238
echo " hotfix/<issue-id>-description"
43-
echo " release/<x.y.z>"
4439
exit 1
4540
fi

.github/workflows/hotfix.yml

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ permissions:
44
contents: write
55

66
on:
7-
push:
7+
pull_request:
8+
types: [closed]
89
branches:
9-
- 'hotfix/*'
10+
- main
11+
- dev
1012

1113
jobs:
1214
hotfix:
1315
runs-on: ubuntu-latest
16+
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'hotfix/')
1417

1518
steps:
1619
- name: 'Checkout code'
@@ -28,11 +31,10 @@ jobs:
2831
run: |
2932
set -e
3033
31-
# Dernier tag vX.Y.Z
34+
# Récupérer le dernier tag vX.Y.Z
3235
LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
3336
3437
if [[ -z "$LATEST_TAG" ]]; then
35-
echo "Aucun tag trouvé, initialisation à v0.0.1"
3638
VERSION="0.0.1"
3739
else
3840
VERSION="${LATEST_TAG#v}"
@@ -44,11 +46,9 @@ jobs:
4446
fi
4547
4648
TAG="v$VERSION"
47-
echo "Nouvelle version candidate : $TAG"
4849
49-
# Vérifie si le tag existe déjà
50+
# Vérifier si le tag existe déjà
5051
if git rev-parse "$TAG" >/dev/null 2>&1; then
51-
echo "⚠️ Le tag $TAG existe déjà, skip."
5252
echo "skip=true" >> $GITHUB_OUTPUT
5353
else
5454
echo "skip=false" >> $GITHUB_OUTPUT
@@ -57,30 +57,27 @@ jobs:
5757
echo "version=$VERSION" >> $GITHUB_OUTPUT
5858
echo "tag=$TAG" >> $GITHUB_OUTPUT
5959
60-
- name: 'Créer le tag git'
61-
if: steps.semver.outputs.skip != 'true'
60+
- name: 'Créer le tag et la release si sur main'
61+
if: steps.semver.outputs.skip != 'true' && github.event.pull_request.base.ref == 'main'
6262
run: |
63+
echo "Récupération du changelog pour ${{ steps.semver.outputs.tag }}"
64+
# Extraire le changelog correspondant à la version
65+
RELEASE_NOTES=$(awk "/^## \[${{ steps.semver.outputs.tag }}\]/ {flag=1; next} /^## / {flag=0} flag" CHANGELOG.md)
66+
echo "$RELEASE_NOTES" > release_notes.md
67+
68+
# Créer le tag
6369
git tag "${{ steps.semver.outputs.tag }}"
6470
git push origin "${{ steps.semver.outputs.tag }}"
6571
66-
- name: 'Extraire la section du changelog'
67-
if: steps.semver.outputs.skip != 'true'
68-
id: changelog
69-
run: |
70-
VERSION="${{ steps.semver.outputs.version }}"
71-
if [[ -f CHANGELOG.md ]]; then
72-
sed -n "/## \[$VERSION\]/,/^## /p" CHANGELOG.md > release_notes.txt
73-
else
74-
echo "No CHANGELOG.md found" > release_notes.txt
75-
fi
76-
echo "release_notes<<EOF" >> $GITHUB_OUTPUT
77-
cat release_notes.txt >> $GITHUB_OUTPUT
78-
echo "EOF" >> $GITHUB_OUTPUT
79-
8072
- name: 'Créer une release GitHub'
81-
if: steps.semver.outputs.skip != 'true'
73+
if: steps.semver.outputs.skip != 'true' && github.event.pull_request.base.ref == 'main'
8274
uses: ncipollo/release-action@v1
8375
with:
8476
tag: '${{ steps.semver.outputs.tag }}'
8577
name: 'Hotfix ${{ steps.semver.outputs.tag }}'
86-
body: '${{ steps.changelog.outputs.release_notes }}'
78+
body: |
79+
$(cat release_notes.md)
80+
81+
- name: 'PR mergée sur dev'
82+
if: github.event.pull_request.base.ref == 'dev'
83+
run: echo "PR mergée sur dev, aucune release ni tag créé."

.github/workflows/release.yml

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,89 @@
11
name: 'Release workflow'
22

3-
on:
4-
push:
5-
branches:
6-
- 'release/*'
7-
83
permissions:
94
contents: write
105

6+
on:
7+
pull_request:
8+
types: [closed]
9+
branches:
10+
- main
11+
1112
jobs:
1213
release:
14+
if: >
15+
github.event.pull_request.merged == true &&
16+
github.event.pull_request.head.ref == 'dev'
17+
1318
runs-on: ubuntu-latest
1419

1520
steps:
16-
# 🔹 1. Checkout complet pour récupérer tous les commits et tags
1721
- name: 'Checkout code'
1822
uses: actions/checkout@v3
1923
with:
2024
fetch-depth: 0
2125

22-
# 🔹 2. Configurer Git pour les commits/tag du bot
23-
- name: 'Set up Git'
26+
- name: 'Configurer Git'
2427
run: |
2528
git config user.name "github-actions[bot]"
2629
git config user.email "github-actions[bot]@users.noreply.github.com"
2730
28-
# 🔹 3. Déterminer la version de release depuis le nom de branche
29-
- name: 'Determine release version'
31+
- name: 'Déterminer la nouvelle version'
3032
id: semver
3133
run: |
32-
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
33-
if [[ "$BRANCH_NAME" =~ ^release/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
34-
VERSION="${BASH_REMATCH[1]}"
35-
echo "Release version: $VERSION"
34+
set -e
35+
36+
# Récupérer le dernier tag vX.Y.Z
37+
LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
38+
39+
if [[ -z "$LATEST_TAG" ]]; then
40+
VERSION="0.1.0"
3641
else
37-
echo "❌ Branch name does not match release/x.y.z"
38-
exit 1
42+
VERSION="${LATEST_TAG#v}"
43+
MAJOR=$(echo "$VERSION" | cut -d. -f1)
44+
MINOR=$(echo "$VERSION" | cut -d. -f2)
45+
PATCH=$(echo "$VERSION" | cut -d. -f3)
46+
MINOR=$((MINOR + 1))
47+
PATCH=0
48+
VERSION="$MAJOR.$MINOR.$PATCH"
3949
fi
40-
echo "version=$VERSION" >> $GITHUB_OUTPUT
4150
42-
# 🔹 4. Créer le tag Git (supprime ancien tag si besoin)
43-
- name: 'Create git tag'
44-
run: |
45-
VERSION="v${{ steps.semver.outputs.version }}"
46-
echo "Creating tag $VERSION"
51+
TAG="v$VERSION"
52+
echo "Nouvelle release : $TAG"
4753
48-
# Supprimer tag local s'il existe
49-
git tag -d $VERSION || true
54+
# Vérifier si le tag existe déjà
55+
if git rev-parse "$TAG" >/dev/null 2>&1; then
56+
echo "❌ Le tag $TAG existe déjà"
57+
exit 1
58+
fi
5059
51-
# Supprimer tag distant s'il existe
52-
git push --delete origin $VERSION || true
60+
echo "version=$VERSION" >> $GITHUB_OUTPUT
61+
echo "tag=$TAG" >> $GITHUB_OUTPUT
5362
54-
# Créer et pousser le tag
55-
git tag $VERSION
56-
git push origin $VERSION
63+
- name: 'Créer le tag'
64+
run: |
65+
git tag "${{ steps.semver.outputs.tag }}"
66+
git push origin "${{ steps.semver.outputs.tag }}"
5767
58-
# 🔹 5. Extraire la section correspondante dans le CHANGELOG.md
59-
- name: 'Extract changelog section'
68+
- name: 'Extraire le changelog'
6069
id: changelog
6170
run: |
6271
VERSION="${{ steps.semver.outputs.version }}"
6372
if [[ -f CHANGELOG.md ]]; then
73+
# Extraire la section du changelog correspondant à cette version
6474
sed -n "/## \[$VERSION\]/,/^## /p" CHANGELOG.md > release_notes.txt
6575
else
66-
echo "No CHANGELOG.md found" > release_notes.txt
76+
echo "Release $VERSION" > release_notes.txt
6777
fi
78+
79+
# Préparer la sortie pour GitHub Actions
6880
echo "release_notes<<EOF" >> $GITHUB_OUTPUT
6981
cat release_notes.txt >> $GITHUB_OUTPUT
7082
echo "EOF" >> $GITHUB_OUTPUT
7183
72-
# 🔹 6. Créer la GitHub Release
73-
- name: 'Create GitHub Release'
84+
- name: 'Créer la GitHub Release'
7485
uses: ncipollo/release-action@v1
7586
with:
76-
tag: v${{ steps.semver.outputs.version }}
77-
name: Release v${{ steps.semver.outputs.version }}
78-
body: ${{ steps.changelog.outputs.release_notes }}
87+
tag: '${{ steps.semver.outputs.tag }}'
88+
name: 'Release ${{ steps.semver.outputs.tag }}'
89+
body: '${{ steps.changelog.outputs.release_notes }}'

.github/workflows/ticket.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,27 @@ jobs:
1010
steps:
1111
- name: 'Vérifier le titre et la branche de la PR pour une référence au ticket'
1212
run: |
13+
set -e
14+
1315
PR_TITLE="${{ github.event.pull_request.title }}"
1416
BRANCH_NAME="${{ github.head_ref }}"
1517
16-
echo "PR title: $PR_TITLE"
17-
echo "Branch name: $BRANCH_NAME"
18-
19-
# Regex pour le titre de PR : doit contenir #<num>
20-
ISSUE_PR_REGEX="#[0-9]+"
21-
22-
# Regex pour le nom de branche : doit contenir le numéro (sans #)
23-
ISSUE_BRANCH_REGEX="[0-9]+"
18+
echo "Titre de PR : $PR_TITLE"
19+
echo "Nom de branche : $BRANCH_NAME"
2420
25-
if [[ $PR_TITLE =~ $ISSUE_PR_REGEX ]]; then
26-
echo "✅ Le titre de la PR contient une référence au ticket."
21+
# Regex pour le commit / titre PR : type(nom): Fixes #<num> - message
22+
if [[ "$PR_TITLE" =~ ^(feat|fix|docs|chore|refactor|test|hotfix)\([a-zA-Z0-9_-]+\):\ Fixes\ \#[0-9]+\ -\ .+ ]]; then
23+
echo "✅ Titre de PR valide avec référence au ticket"
2724
exit 0
28-
elif [[ $BRANCH_NAME =~ $ISSUE_BRANCH_REGEX ]]; then
29-
echo "✅ Le nom de la branche contient un numéro de ticket."
25+
fi
26+
27+
# Regex pour le nom de branche : feature/123-description, fix/123-description, hotfix/123-description
28+
if [[ "$BRANCH_NAME" =~ ^(feature|fix|hotfix)/[0-9]+-.+ ]]; then
29+
echo "✅ Nom de branche valide avec référence au ticket"
3030
exit 0
31-
else
32-
echo "❌ Aucune référence au ticket trouvée !"
33-
echo "Incluez une référence dans le titre de la PR (#<num>) ou le nom de la branche (numéro du ticket)."
34-
exit 1
3531
fi
32+
33+
echo "❌ Aucune référence valide au ticket trouvée !"
34+
echo "Le titre de la PR doit être au format : type(nom): Fixes #<num> - message"
35+
echo "Exemple de nom de branche valide : feature/123-description"
36+
exit 1

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727

2828
---
2929

30+
## [0.0.3] - 2026-01-18
31+
32+
### Ajouté
33+
34+
- Documentation
35+
- data.md
36+
- mcd.md
37+
- mld.md
38+
39+
### Changement
40+
41+
- workflow
42+
43+
---
44+
3045
## [0.0.2] - 2025-12-28
3146

3247
### Ajouté

0 commit comments

Comments
 (0)