Skip to content

Commit

Permalink
refactor: improve metadata handling in build script - Add Get-PluginM…
Browse files Browse the repository at this point in the history
…etadata function for dynamic version handling - Integrate metadata generation into build process - Generate readme.txt during build with proper metadata
  • Loading branch information
Pimzino committed Jan 11, 2025
1 parent b52781e commit 5716651
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ function Start-Build {
Remove-Item $zipPath -Force
}

# Write metadata to readme.txt
$readmePath = Join-Path $buildPath "readme.txt"
Write-BuildLog "Writing plugin metadata to readme.txt..." -Level Info
$metadata = Get-PluginMetadata -Version $version
Set-Content -Path $readmePath -Value $metadata
Write-BuildLog "Plugin metadata written successfully" -Level Success

Compress-Archive -Path "$buildPath\*" -DestinationPath $zipPath
Write-BuildLog "Created plugin package at: $zipPath" -Level Success

Expand Down Expand Up @@ -300,21 +307,25 @@ function Copy-ProjectFiles {
return $Destination
}

# Start the build process
Start-Build

# Plugin metadata
$metadata = @"
# Plugin metadata function
function Get-PluginMetadata {
param([string]$Version)
return @"
=== WP Post to PDF ===
Contributors: pimzino
Tags: pdf, export, posts, print
Requires at least: 5.2
Tested up to: 6.4
Requires PHP: 7.2
Stable tag: 1.1.0
Stable tag: $Version
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Version: 1.1.0
Version: $Version
A powerful WordPress plugin that enables users to export blog posts to beautifully formatted, printable PDFs with extensive customization options.
"@
}

# Start the build process
Start-Build

0 comments on commit 5716651

Please sign in to comment.