generated from dopt-python/py311-cython
85 lines
2.8 KiB
PowerShell
85 lines
2.8 KiB
PowerShell
$DEPLOYMENT_PATH = 'B:\deployments\POLLU-BLOCK'
|
|
$ENV_PATH = 'B:\deployments\POLLU-BLOCK\dopt_pollu-block_blockchain'
|
|
$PY_PATH = Join-Path -Path $ENV_PATH -ChildPath 'python'
|
|
$SRC_PATH = (Get-Location).Path
|
|
|
|
Write-Output "Build Pipeline for d-opt POLLU-BLOCK blockchain"
|
|
Write-Output "Building package..."
|
|
.\scripts\publish.ps1
|
|
if ($? -eq $false){
|
|
Write-Output "[PWSH] Exiting script because there were build errors"
|
|
Exit
|
|
}
|
|
Write-Output "Built package successfully"
|
|
|
|
Write-Output "Generate README..."
|
|
.\scripts\cvt_readme.ps1
|
|
if ($? -eq $false){
|
|
Write-Output "[PWSH] Exiting script because there errors while generating the README file"
|
|
Exit
|
|
}
|
|
Write-Output "Generated README file successfully"
|
|
|
|
Write-Output "Go into env directory..."
|
|
Set-Location $ENV_PATH
|
|
Write-Output "Install package into environment..."
|
|
pycage venv add -i http://localhost:8001/simple/ dopt-pollublock-blockchain
|
|
if ($? -eq $false){
|
|
Write-Output "[PWSH] Exiting script because there were errors while installing the package into the environment"
|
|
Exit
|
|
}
|
|
Write-Output "Successfully installed package"
|
|
|
|
# copy CLI file
|
|
Write-Output "Copying CLI script file..."
|
|
$cli_path = Join-Path -Path $SRC_PATH -ChildPath 'pollublock.py'
|
|
Copy-Item -Path $cli_path -Destination $PY_PATH -Force
|
|
if ($? -eq $false){
|
|
Write-Output "[PWSH] Exiting script because there were errors while copying the CLI script file"
|
|
Exit
|
|
}
|
|
Write-Output "Copied CLI script file successfully"
|
|
|
|
# copy README file
|
|
Write-Output "Copying README file..."
|
|
$readme_path = Join-Path -Path $SRC_PATH -ChildPath 'README.pdf'
|
|
Copy-Item -Path $readme_path -Destination $ENV_PATH -Force
|
|
if ($? -eq $false){
|
|
Write-Output "[PWSH] Exiting script because there were errors while copying the README file"
|
|
Exit
|
|
}
|
|
Write-Output "Copied README script file successfully"
|
|
|
|
# env preparation
|
|
Write-Output "Preparing environment with cleanup and pre-compilation..."
|
|
pycage clean dist-info
|
|
if ($? -eq $false){
|
|
Write-Output "[PWSH] Exiting script because there were errors while deleting the distribution info files"
|
|
Exit
|
|
}
|
|
pycage compile -q -d -f
|
|
if ($? -eq $false){
|
|
Write-Output "[PWSH] Exiting script because there were errors during the pre-compilation process"
|
|
Exit
|
|
}
|
|
Write-Output "Successfully prepared environment with cleanup and pre-compilation"
|
|
|
|
|
|
Write-Output "Packaging whole standalone environment in a ZIP file"
|
|
$dest_path = Join-Path -Path $DEPLOYMENT_PATH -ChildPath "dopt_pollu-block_blockchain.zip"
|
|
$compress = @{
|
|
Path = "$ENV_PATH\**"
|
|
CompressionLevel = "Optimal"
|
|
DestinationPath = $dest_path
|
|
}
|
|
Compress-Archive @compress -Force
|
|
|
|
if ($? -eq $false){
|
|
Write-Output "[PWSH] Exiting script because there were errors during the archive compression operation"
|
|
Exit
|
|
}
|
|
Write-Output "Successfully compressed archive. Saved under: >$dest_path<"
|
|
|
|
Write-Output "Go back to source directory..."
|
|
Set-Location $SRC_PATH
|