Skip to content

Commit a035ed6

Browse files
Merge pull request #267 from InseeFr/release171
1.7.1
2 parents a7410e4 + cd836ef commit a035ed6

File tree

3 files changed

+75
-21
lines changed

3 files changed

+75
-21
lines changed

.github/workflows/pr-version.yaml

Lines changed: 69 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,86 @@
1-
name: New Release Action
1+
name: Version Update Action
22

33
on:
44
pull_request:
55
branches:
6-
- main
6+
- main
77
types: [labeled]
88

99
jobs:
10-
upgrade-poms:
10+
update-pom-version:
1111
runs-on: ubuntu-latest
12-
if: contains(github.event.pull_request.labels.*.name, 'New Release')
12+
if: >
13+
contains(github.event.pull_request.labels.*.name, 'Version Update - Staging') ||
14+
contains(github.event.pull_request.labels.*.name, 'Version Update - Prod')
1315
steps:
14-
- name: Check out code
16+
- name: Checkout PR branch
1517
uses: actions/checkout@v4
1618
with:
1719
ref: ${{ github.head_ref }}
18-
- name: Extract version number
20+
21+
- name: Get Short SHA
22+
id: sha
23+
run: echo "sha_short=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_OUTPUT
24+
25+
- name: Extract version from PR title
1926
id: extract_version
2027
run: |
21-
VERSION_NUMBER=$(echo '${{ github.event.pull_request.title }}' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
22-
echo "new_version=${VERSION_NUMBER}" >> $GITHUB_OUTPUT
28+
TITLE_VERSION=$(echo "${{ github.event.pull_request.title }}" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' || true)
29+
echo "title_version=$TITLE_VERSION" >> $GITHUB_OUTPUT
30+
if [ -z "$TITLE_VERSION" ]; then
31+
echo "No version in PR title. Will increment patch."
32+
else
33+
echo "Detected version in PR title: $TITLE_VERSION"
34+
fi
35+
36+
- name: Get current version from pom.xml
37+
id: current_version
38+
run: |
39+
CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
40+
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
41+
echo "Current POM version: $CURRENT_VERSION"
42+
43+
- name: Determine base version
44+
id: base_version
45+
env:
46+
TITLE_VERSION: ${{ steps.extract_version.outputs.title_version }}
47+
CUR_VERSION: ${{ steps.current_version.outputs.current_version }}
48+
run: |
49+
if [ -n "$TITLE_VERSION" ]; then
50+
BASE_VERSION="$TITLE_VERSION"
51+
else
52+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CUR_VERSION"
53+
PATCH=$((PATCH + 1))
54+
BASE_VERSION="$MAJOR.$MINOR.$PATCH"
55+
echo "Auto-incremented patch version: $BASE_VERSION"
56+
fi
57+
echo "base_version=$BASE_VERSION" >> $GITHUB_OUTPUT
58+
59+
- name: Determine final version
60+
id: final_version
61+
env:
62+
BASE_VERSION: ${{ steps.base_version.outputs.base_version }}
63+
STAGING_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'Version Update - Staging') }}
64+
SHA_SHORT: ${{ steps.sha.outputs.sha_short }}
65+
run: |
66+
if [[ "$STAGING_LABEL" == "true" ]]; then
67+
FINAL_VERSION="${BASE_VERSION}-${SHA_SHORT}"
68+
else
69+
FINAL_VERSION="${BASE_VERSION}"
70+
fi
71+
echo "Final version to set: $FINAL_VERSION"
72+
echo "final_version=$FINAL_VERSION" >> $GITHUB_OUTPUT
2373
24-
- name: Check for New Release label
74+
- name: Update Maven Version
2575
run: |
26-
echo "New Release label detected on PR #${{ github.event.pull_request.number }}"
27-
echo "Version number: ${{ steps.extract_version.outputs.new_version }}"
28-
29-
# Mettez ici vos commandes ou scripts à exécuter
30-
mvn versions:set -DnewVersion='${{ steps.extract_version.outputs.new_version }}' -DprocessAllModules
31-
mvn versions:set-property -Dproperty=kraftwerk.version -DnewVersion='${{ steps.extract_version.outputs.new_version }}'
76+
mvn versions:set -DnewVersion="${{ steps.final_version.outputs.final_version }}" -DprocessAllModules
3277
mvn versions:commit
33-
git config --global user.name 'github-actions'
34-
git config --global user.email 'github-actions@github.com'
35-
git commit -m "Update version - auto" --all
36-
git push
78+
79+
- name: Commit and Push
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
run: |
83+
git config user.name 'github-actions'
84+
git config user.email 'github-actions@github.com'
85+
git commit -am "chore: update version to ${{ steps.final_version.outputs.final_version }}" || echo "No changes to commit"
86+
git push

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Changelog
2+
## 1.7.1 [2025-07-31]
3+
### Updated
4+
- BPM 1.0.9
5+
26
## 1.7.0 [2025-07-31]
37
### Added
48
- Back office user role

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>fr.insee.genesis</groupId>
66
<artifactId>genesis-api</artifactId>
7-
<version>1.7.0</version>
7+
<version>1.7.1</version>
88
<packaging>jar</packaging>
99
<name>genesis-api</name>
1010

@@ -34,7 +34,7 @@
3434
<pitest.version>1.20.1</pitest.version>
3535
<pitest.junit.version>1.2.3</pitest.junit.version>
3636
<jackson.version>2.19.0</jackson.version>
37-
<bpm.version>1.0.8</bpm.version>
37+
<bpm.version>1.0.9</bpm.version>
3838
</properties>
3939
<dependencies>
4040
<dependency>

0 commit comments

Comments
 (0)