Skip to content

Commit

Permalink
feat(release.sh): fix bug release`s MRC in release.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
hbelkhir committed Jan 10, 2025
1 parent 10f0c8d commit 4fb6629
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 28 deletions.
48 changes: 26 additions & 22 deletions scripts/release/release-mrcv1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ version_mrc() {
node_modules/.bin/lerna version --scope=manager-react-components --conventional-commits --no-commit-hooks --no-git-tag-version --no-push --allow-branch="${GIT_BRANCH}" --yes
else
printf "%s\n" "Releasing"
node_modules/.bin/lerna exec --scope=@ovh-ux/manager-react-components -- lerna version --conventional-commits --no-commit-hooks --no-git-tag-version --no-push --no-private --ignore-changes="packages/modules/manager-pci-common/**" --yes
node_modules/.bin/lerna exec --scope=@ovh-ux/manager-react-components -- lerna version --conventional-commits --no-commit-hooks --no-git-tag-version --no-push --no-private --ignore-changes="packages/manager/modules/manager-pci-common/**" --yes
fi
}

Expand Down Expand Up @@ -118,33 +118,37 @@ main() {
current_tag="$(git describe --abbrev=0)"
printf "%s\n" "Previous tag was $current_tag"

# For manager-react-components (MRC), version it specifically
if echo "$changed_packages" | grep -q "manager-react-components"; then
# Only version MRC package
next_tag=$(get_release_name "$SEED")
printf "%s\n" "New tag for MRC: $next_tag"

RELEASE_NOTE+="# Release $next_tag\
# Separate versioning for `manager-react-components` and other packages
mrc_changed=false
while read -r package; do
name=$(echo "$package" | cut -d ':' -f 2)
version=$(echo "$package" | cut -d ':' -f 3)

# Check if the changed package is `manager-react-components`
if [[ "$name" == *manager-react-components* ]]; then
mrc_changed=true
path_mrc=$(echo "$package" | cut -d ':' -f 1)
name_mrc=$(echo "$package" | cut -d ':' -f 2)
create_smoke_tag "$current_tag" "$name" "$version"
fi
done <<< "$changed_packages"

# Handle `manager-react-components` separately
if [ "$mrc_changed" == true ]; then
next_tag=$(get_release_name "$SEED")
printf "%s\n" "New tag for manager-react-components: $next_tag"

"
RELEASE_NOTE+="# Release $next_tag\n\n"

# Update Sonar version for the new tag
update_sonar_version "$next_tag"

# Version the MRC package
version_mrc

# Update the changelog for MRC package
path="packages/manager-react-components" # Adjust path as needed
name="manager-react-components"
RELEASE_NOTE+="$(create_release_note "$path" "$name")\
version_mrc "$next_tag"

"
# Create release note for manager-react-components
RELEASE_NOTE+="$(create_release_note "$path_mrc" "$name_mrc")\n\n"

# Commit changes and tag
push_and_release "$next_tag"
# Commit and release manager-react-components
clean_tags
#push_and_release "$next_tag"
else
printf "%s\n" "No changes detected for manager-react-components. Exiting."
exit 0
Expand Down
16 changes: 10 additions & 6 deletions scripts/release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ version() {
node_modules/.bin/lerna version --conventional-commits --no-commit-hooks --no-git-tag-version --no-push --allow-branch="${GIT_BRANCH}" --yes
else
printf "%s\n" "Releasing"
node_modules/.bin/lerna version --conventional-commits --no-commit-hooks --no-git-tag-version --no-push --yes --ignore-changes="packages/manager-react-components/**"
node_modules/.bin/lerna version --conventional-commits --no-commit-hooks --no-git-tag-version --no-push --yes --ignore-changes="packages/manager-react-components/**,packages/manager/modules/manager-pci-common/**"
fi
}

Expand All @@ -54,7 +54,7 @@ version_mrc() {
node_modules/.bin/lerna version --scope=manager-react-components --conventional-commits --no-commit-hooks --no-git-tag-version --no-push --allow-branch="${GIT_BRANCH}" --yes
else
printf "%s\n" "Releasing"
node_modules/.bin/lerna exec --scope=@ovh-ux/manager-react-components -- lerna version --conventional-commits --no-commit-hooks --no-git-tag-version --no-push --no-private --ignore-changes="packages/modules/manager-pci-common/**" --yes
node_modules/.bin/lerna exec --scope=@ovh-ux/manager-react-components -- lerna version --conventional-commits --no-commit-hooks --no-git-tag-version --no-push --no-private --ignore-changes="packages/manager/modules/manager-pci-common/**" --yes
fi
}

Expand Down Expand Up @@ -132,7 +132,7 @@ main() {
done

changed_packages=$(get_changed_packages)
printf "%s\n" "Changed packages $changed_packages"

if [ -z "$changed_packages" ]; then
printf "%s\n" "Nothing to release"
exit 0
Expand All @@ -152,6 +152,7 @@ main() {
mrc_changed=true
path_mrc=$(echo "$package" | cut -d ':' -f 1)
name_mrc=$(echo "$package" | cut -d ':' -f 2)
create_smoke_tag "$current_tag" "$name_mrc" "$version"
else
create_smoke_tag "$current_tag" "$name" "$version"
fi
Expand All @@ -170,9 +171,9 @@ main() {
# Create release note for manager-react-components
RELEASE_NOTE+="$(create_release_note "$path_mrc" "$name_mrc")\n\n"

#Commit and release manager-react-components
# Commit and release manager-react-components
clean_tags
#push_and_release "$next_tag"
push_and_release "$next_tag"
fi

# Handle the rest of the packages
Expand All @@ -181,16 +182,19 @@ main() {
RELEASE_NOTE+="# Release $next_tag\n\n"
update_sonar_version "$next_tag"
version "$next_tag"

# Generate formatted release notes for other packages
while read -r package; do
path=$(echo "$package" | cut -d ':' -f 1)
name=$(echo "$package" | cut -d ':' -f 2)
RELEASE_NOTE+="$(create_release_note "$path" "$name")\n\n"
done <<< "$changed_packages"

# Remove package-specific tags for other packages
clean_tags

# Push and release for other packages
#push_and_release "$next_tag"
push_and_release "$next_tag"

}

Expand Down

0 comments on commit 4fb6629

Please sign in to comment.