Skip to content

Commit

Permalink
Create zip with version number
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavobazzo committed Oct 20, 2022
1 parent 472524e commit ccb9d1d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
14 changes: 0 additions & 14 deletions create-zip.bat

This file was deleted.

30 changes: 30 additions & 0 deletions create-zip.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function Get-PluginVersion {
$file_data = Get-Content ./src/version.php | Where-Object {$_ -like "*$plugin->release*"}

$CharArray = $file_data.Split("=")

$result = $CharArray[1].replace("'", "").replace(";","").trim()

return $result
}

function Create-Zipfile($zipName, $pluginName, $pluginVersion){
#remove the current zip file
$zipFile="$($zipName)-$($pluginVersion).zip"

if(Test-Path -Path $zipFile -PathType Leaf){
Remove-Item -Path $zipFile
}

#zip the folder except the folders .cache and node_modules
& "c:\Program Files\7-Zip\7z.exe" a -mx "$zipFile" "src\*" -mx0 -xr!"src\react_app\.cache" -xr!"src\react_app\node_modules"

#set the plugin name
& "c:\Program Files\7-Zip\7z.exe" rn "$zipFile" "src\" "$pluginName\"
}

$zipName="format_recit"
$pluginName="recit"
$pluginVersion = Get-PluginVersion

Create-Zipfile $zipName $pluginName $pluginVersion

0 comments on commit ccb9d1d

Please sign in to comment.