param( [string]$PythonExecutable = "C:\Users\edsoe\AppData\Local\Programs\Python\Python313\python.exe" ) $ErrorActionPreference = "Stop" $scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path $repositoryRoot = (Resolve-Path (Join-Path $scriptDirectory "..\..")).Path $publisher = Join-Path $scriptDirectory "publish_future_map_insights.py" $logDirectory = Join-Path $repositoryRoot "logs" $logFile = Join-Path $logDirectory ("future-map-insights-hub-" + (Get-Date -Format "yyyy-MM-dd") + ".log") New-Item -ItemType Directory -Path $logDirectory -Force | Out-Null $started = Get-Date -Format "yyyy-MM-dd HH:mm:ss zzz" "[$started] Starting Future Map Insights Hub publication." | Set-Content -LiteralPath $logFile -Encoding utf8 $publisherOutput = & $PythonExecutable $publisher 2>&1 $exitCode = $LASTEXITCODE $publisherOutput | Add-Content -LiteralPath $logFile -Encoding utf8 $finished = Get-Date -Format "yyyy-MM-dd HH:mm:ss zzz" "[$finished] Finished with exit code $exitCode." | Add-Content -LiteralPath $logFile -Encoding utf8 if ($exitCode -ne 0) { throw "Future Map Insights Hub publication failed with exit code $exitCode. See $logFile" }