Last active
March 22, 2023 09:57
-
-
Save jeroensmink98/fbcdb9751ba42e518697d9c99ccedb0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the root folder path | |
$rootFolderPath = (Get-Location).Path | |
# Set the nugetType variable | |
$nugetType = "Framework" | |
# Create the .pipelines folder if it doesn't exist | |
$pipelinesFolderPath = Join-Path -Path $rootFolderPath -ChildPath ".pipelines" | |
if (-not (Test-Path -Path $pipelinesFolderPath)) { | |
New-Item -ItemType Directory -Path $pipelinesFolderPath | Out-Null | |
} | |
# Get all directories in the root folder | |
$directories = Get-ChildItem -Path $rootFolderPath -Directory | |
# Iterate through each directory and create the corresponding YAML file | |
foreach ($directory in $directories) { | |
$parts = $directory.Name.Split('.') | |
$filename = ($parts -join '-').ToLower() + "-nuget.yml" | |
$filepath = Join-Path -Path $pipelinesFolderPath -ChildPath $filename | |
# Find the .csproj file in the directory | |
$csprojFile = Get-ChildItem -Path $directory.FullName -Filter "*.csproj" | Select-Object -First 1 | |
$relativeCsprojPath = $csprojFile.FullName.Replace($rootFolderPath, '').TrimStart('\') | |
# Generate the YAML content | |
$yamlContent = @" | |
PLACE YAML CONTENT HERE! | |
"@ | |
# Write the YAML content to the file | |
Set-Content -Path $filepath -Value $yamlContent | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$rootFolderPath
is now the current directory where the script is being executed