Skip to content

Commit 8ed21f8

Browse files
author
LE SAULNIER Kevin
committed
feat: implement git tagging
Signed-off-by: LE SAULNIER Kevin <[email protected]>
1 parent 844e4c9 commit 8ed21f8

File tree

2 files changed

+29
-51
lines changed

2 files changed

+29
-51
lines changed
Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1 @@
1-
https://github.com/gridsuite/actions-server
2-
https://github.com/gridsuite/admin-tools
3-
https://github.com/gridsuite/cgmes-gl-server
4-
https://github.com/gridsuite/config-notification-server
5-
https://github.com/gridsuite/config-server
6-
https://github.com/gridsuite/deployment
7-
https://github.com/gridsuite/directory-notification-server
8-
https://github.com/gridsuite/directory-server
9-
https://github.com/gridsuite/explore-server
10-
https://github.com/gridsuite/filter-server
11-
https://github.com/gridsuite/gateway
12-
https://github.com/gridsuite/geo-data-server
13-
https://github.com/gridsuite/gridadmin-app
14-
https://github.com/gridsuite/gridexplore-app
15-
https://github.com/gridsuite/gridstudy-app
16-
https://github.com/gridsuite/loadflow-server
17-
https://github.com/gridsuite/network-map-server
18-
https://github.com/gridsuite/network-modification-server
19-
https://github.com/gridsuite/odre-server
20-
https://github.com/gridsuite/report-server
21-
https://github.com/gridsuite/security-analysis-server
22-
https://github.com/gridsuite/study-config-server
23-
https://github.com/gridsuite/study-server
24-
https://github.com/gridsuite/study-notification-server
25-
https://github.com/gridsuite/user-admin-server
26-
https://github.com/gridsuite/sensitivity-analysis-server
27-
https://github.com/gridsuite/shortcircuit-server
28-
https://github.com/gridsuite/voltage-init-server
29-
https://github.com/gridsuite/case-import-server
30-
https://github.com/gridsuite/user-identity-oidc-replication-server
1+
https://github.com/gridsuite/ci-cd-test

.github/workflows/prepare-release.yml

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ on:
99
target_date:
1010
description: "Date of last commit to inlude (ISO 8601, ex: 2024-09-13T23:59:59Z - default : last friday 23:59:59)."
1111
required: false
12+
release-version:
13+
description: "Version for new tag (ex: v2.8.0)"
14+
required: true
1215

1316
jobs:
14-
list-shas:
17+
prepare-release:
1518
runs-on: ubuntu-latest
1619
steps:
1720
- name: Checkout aggregator repository
@@ -38,7 +41,7 @@ jobs:
3841
echo "EOF" >> $GITHUB_OUTPUT
3942
4043
- name: Extract last commit date (last friday 23:59 UTC if left empty)
41-
id: date
44+
id: load_date
4245
run: |
4346
if [ -z "${{ github.event.inputs.target_date }}" ]; then
4447
date_value=$(date -u -d "last friday 23:59" +"%Y-%m-%dT%H:%M:%SZ")
@@ -50,28 +53,32 @@ jobs:
5053
5154
- name: Lister les SHAs des commits
5255
run: |
56+
mkdir public_repos
57+
cd public_repos
58+
5359
while read url; do
54-
if [[ "$url" =~ github.com[:/]+([^/]+)/([^/]+)(\.git)?$ ]]; then
55-
org="${BASH_REMATCH[1]}"
56-
repo="${BASH_REMATCH[2]}"
57-
repo="${repo%.git}"
58-
else
59-
echo "❌ Could not parse repository url : $url"
60-
continue
61-
fi
62-
commit=$(gh api repos/$org/$repo/commits \
63-
--method GET \
64-
-f until="2025-09-12T23:59:00Z" \
65-
-F per_page=1 \
66-
--jq '.[0] | {sha: .sha, message: .commit.message}')
60+
git clone $url
61+
folder=$(basename "$url" .git)
62+
cd $folder
63+
commit_date='${{ steps.load_date.outputs.date_value }}''
64+
commit_hash=$(git rev-list -n 1 --before="$commit_date" main)
65+
git checkout $commit_hash
6766
68-
sha=$(echo "$commit" | jq -r .sha | cut -c1-7)
69-
msg=$(echo "$commit" | jq -r .message | head -n1 | cut -c1-60)
67+
branch_name="prepare-release-${{github.event.inputs.release-version}}"
68+
# Check if *branch_name* already exists
69+
if git show-ref --verify --quiet "refs/heads/$branch_name"; then
70+
echo "❌ Warning for $folder: Branch $branch_name already exists"
71+
exit 1
72+
fi
73+
git checkout -b "$branch_name"
7074
71-
if [[ -z "$sha" || "$sha" == "null" ]]; then
72-
echo "❌ Aucun commit trouvé pour $repo avant last friday"
73-
continue
75+
if ! git push origin "$branch_name"; then
76+
echo "❌ Error for $folder: Failed to push $branch_name"
77+
exit 1
7478
fi
7579
76-
echo "✅ $repo → $sha | $msg"
80+
commit_message=$(git log -1 --pretty=%s | cut -c1-50)
81+
82+
echo "✅ $folder tagged → $commit_hash | $commit_message"
83+
cd - > /dev/null
7784
done <<< "${{ steps.load_repos.outputs.list }}"

0 commit comments

Comments
 (0)