Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuget: Lionk.Logger minor, Lionk.Utils minor #165

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions .github/workflows/scripts/nuget_scripts/process_csproj.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ def update_or_add_element(container, name, value=None, attributes=None):
new_element.set(attr_name, attr_value)
# Si aucune valeur de texte n'est spécifiée, laisser l'élément vide




# get environment variables
# Récupérer les variables d'environnement
LIB_PATH = os.getenv("LIB_PATH")
projects = os.getenv("PROJECTS").split()
newversions = os.getenv("NEW_VERSION").split()
Expand All @@ -52,24 +49,32 @@ def update_or_add_element(container, name, value=None, attributes=None):
new_version = newversions[projects.index(project)]

if project in changelogs:
changes = f"##{new_version} Changelog"
changes = f"## {new_version} Changelog"
for change in changelogs[project]:
changes += f"\n- {change}"

tree = ET.parse(csproj_file)
root = tree.getroot()

# Trouver ou créer PropertyGroup
property_group = root.find('PropertyGroup')
if property_group is None:
property_group = ET.SubElement(root, 'PropertyGroup')

# Trouver ou créer ItemGroup
item_group = root.find('ItemGroup')
if item_group is None:
item_group = ET.SubElement(root, 'ItemGroup')

# update or add Version and Description elements
update_or_add_element(property_group ,"Version", value=new_version)
update_or_add_element(property_group ,"PackageReleaseNotes", value=changes)
# Mettre à jour ou ajouter les éléments Version, PackageReleaseNotes et PackageReadmeFile
update_or_add_element(property_group, "Version", value=new_version)
update_or_add_element(property_group, "PackageReleaseNotes", value=changes)
if os.path.exists(readme_file):
update_or_add_element(property_group ,"PackageReadmeFile", "README.md")
update_or_add_element(property_group, "PackageReadmeFile", "README.md")
update_or_add_element(item_group, 'None', attributes={'Include': 'README.md', 'Pack': 'true', 'PackagePath': ''})

indent(root)
tree.write(csproj_file, encoding="utf-8", xml_declaration=True)

# show the updated csproj file
# Afficher le fichier .csproj mis à jour
ET.dump(root)
Loading