Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHinsh committed Aug 21, 2024
1 parent 727f30a commit 1aca8db
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 159 deletions.
56 changes: 38 additions & 18 deletions build/include/ReleaseMan.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function Update-Releases {
param (
[string]$releaseFilePath = "./releases.json",
[string]$releaseFilePath = "./docs/_data/releases.json",
[int]$limit = 10
)

Expand Down Expand Up @@ -130,8 +130,8 @@ function Parse-Version {
# Function to update and return the release groups
function Update-ReleaseGroups-Minor {
param (
[string]$releaseFilePath = "./releases.json",
[string]$outputFilePath = "./releases-grouped-minor.json"
[string]$releaseFilePath = "./docs/_data/releases.json",
[string]$outputFilePath = "./docs/_data/releases-grouped-minor.json"
)

# Load the releases from releases.json
Expand Down Expand Up @@ -218,8 +218,8 @@ function Update-ReleaseGroups-Minor {

function Update-ReleaseGroups-MinorSummaries {
param (
[string]$inputFilePath = "./releases-grouped-minor.json",
[string]$outputFilePath = "./releases-grouped-minor.json"
[string]$inputFilePath = "./docs/_data/releases-grouped-minor.json",
[string]$outputFilePath = "./docs/_data/releases-grouped-minor.json"
)

# Load the grouped minor releases
Expand Down Expand Up @@ -257,8 +257,8 @@ function Update-ReleaseGroups-MinorSummaries {

function Update-ReleaseGroups-Major {
param (
[string]$inputFilePath = "./releases-grouped-minor.json",
[string]$outputFilePath = "./releases-grouped-major.json"
[string]$inputFilePath = "./docs/_data/releases-grouped-minor.json",
[string]$outputFilePath = "./docs/_data/releases-grouped-major.json"
)

# Load the grouped minor releases
Expand Down Expand Up @@ -362,8 +362,8 @@ function Update-ReleaseGroups-Major {

function Update-ReleaseGroups-MajorSummaries {
param (
[string]$inputFilePath = "./releases-grouped-major.json",
[string]$outputFilePath = "./releases-grouped-major.json"
[string]$inputFilePath = "./docs/_data/releases-grouped-major.json",
[string]$outputFilePath = "./docs/_data/releases-grouped-major.json"
)

# Load the grouped major releases
Expand Down Expand Up @@ -401,28 +401,51 @@ function Update-ReleaseGroups-MajorSummaries {
}



function Get-ChangeLogMarkdown {
param (
[string]$inputFilePath = "./releases-grouped-major.json",
[string]$outputFilePath = "./change-log.md"
[string]$inputFilePath = "./docs/_data/releases-grouped-major.json",
[string]$outputFilePath = "./docs/change-log.md"
)

# Load the grouped major releases
$groupedReleases = Get-Content -Raw -Path $inputFilePath | ConvertFrom-Json

# Initialize an array to hold the markdown lines
$markdownLines = @()
# Initialize an array to hold the markdown lines, starting with the header
$markdownLines = @(
"---",
"title: Change Log",
"layout: page",
"template: default",
"pageType: index",
"toc: true",
"pageStatus: published",
"discussionId: ",
"redirect_from: /change-log.html",
"---",
"",
"## Change Log",
""
)

# Iterate through each major release
foreach ($majorRelease in $groupedReleases) {
$majorReleaseMajor = $majorRelease.Major
$majorReleaseLatestTagName = $majorRelease.LatestTagName
$majorReleaseSummary = $majorRelease.Summary

# Generate the major release markdown
$majorLine = "- [${majorRelease.LatestMinor}](https://github.com/nkdAgility/azure-devops-migration-tools/releases/tag/${majorRelease.LatestTagName}) - ${majorRelease.Summary}"
$majorLine = "- [v$majorReleaseMajor.0](https://github.com/nkdAgility/azure-devops-migration-tools/releases/tag/$majorReleaseLatestTagName) - $majorReleaseSummary"
$markdownLines += $majorLine

# Iterate through the minor releases under this major release
foreach ($minorRelease in $majorRelease.Releases) {
$minorLatestTagName = $minorRelease.LatestTagName
$minorSummary = $minorRelease.Summary
$minorReleaseMinor = $minorRelease.Minor

# Generate the minor release markdown
$minorLine = " - [${minorRelease.Minor}](https://github.com/nkdAgility/azure-devops-migration-tools/releases/tag/${minorRelease.LatestTagName}) - ${minorRelease.Summary}"
$minorLine = " - [v$minorReleaseMinor](https://github.com/nkdAgility/azure-devops-migration-tools/releases/tag/$minorLatestTagName) - $minorSummary"
$markdownLines += $minorLine
}
}
Expand All @@ -435,6 +458,3 @@ function Get-ChangeLogMarkdown {

Write-Host "Change log markdown has been generated and saved to $outputFilePath"
}

# Call the function to generate the markdown
Get-ChangeLogMarkdown
57 changes: 3 additions & 54 deletions build/mantainReleaseLog.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
. ./build/include/ReleaseMan.ps1

# Define file paths
$releaseFilePath = "./releases.json"
$outputFilePath = "./releases-grouped.json"
$releaseFilePath = "./docs/_data/releases.json"
$outputFilePath = "./docs/_data/releases-grouped.json"

# Step 1: Update releases with the latest data
$updatedReleases = Update-Releases -releaseFilePath $releaseFilePath -limit 10
Expand All @@ -25,55 +25,4 @@ Update-ReleaseGroups-Major
Update-ReleaseGroups-MajorSummaries
Get-ChangeLogMarkdown

#==============================================================================

# Function to generate change log markdown
function Generate-ChangeLog {
param (
[Parameter(Mandatory = $true)]
[array]$groupedReleases,

[Parameter(Mandatory = $true)]
[string]$outputFilePath
)

# Initialize an array to hold the markdown lines
$markdownLines = @("## Change Log")

# Iterate through each major release
foreach ($majorRelease in $groupedReleases) {
$majorVersion = $majorRelease.Major
$majorSummary = $majorRelease.summary

# Add major release summary to markdown
$markdownLines += "- v$majorVersion - $majorSummary"

# Get minor releases for the major version
$minorReleases = $majorRelease.Releases

# Filter out minor releases with a single entry or no summary
if ($minorReleases.Count -gt 1) {
foreach ($minorRelease in $minorReleases) {
$minorVersion = $minorRelease.Minor
$minorSummary = $minorRelease.summary

# Add minor release summary to markdown
$markdownLines += " - v$majorVersion.$minorVersion - $minorSummary"
}
}
}

# Save the markdown content to the output file
$markdownContent = $markdownLines -join "`n"
Set-Content -Path $outputFilePath -Value $markdownContent

Write-Host "Change log saved to $outputFilePath"
}

# Define file path for the change log
$changeLogFilePath = "./change-log.md"

# Generate the change log and save it
Generate-ChangeLog -groupedReleases $groupedReleases -outputFilePath $changeLogFilePath

$groupedReleases
#==============================================================================
87 changes: 0 additions & 87 deletions change-log.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 1aca8db

Please sign in to comment.