@@ -12,20 +12,20 @@ Prerequisites
1212* **Python ≥ 3** (`python` in PATH) – runs the changelog generator
1313* **AWS CLI v2** – credentials via `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`,
1414 `AWS_DEFAULT_REGION` (and optional `AWS_SESSION_TOKEN`)
15- * Environment variable **`API_WEB_RAVENDB_NET_HOST `** set (only required when regenerating
15+ * Environment variable **`WHATS_NEW_URL `** set (only required when regenerating
1616 *What's New* for specific versions)
1717* Project `package.json` includes `@docusaurus/core` and `@docusaurus/cli`
1818
1919Example
2020-------
2121```powershell
22- # API_WEB_RAVENDB_NET_HOST must be set if you request specific versions
23- $env:API_WEB_RAVENDB_NET_HOST = 'YOUR-API-KEY '
22+ # WHATS_NEW_URL must be set if you request specific versions
23+ $env:WHATS_NEW_URL = 'https://whats.new.api/v1/docs '
2424
2525pwsh deploy.ps1 \
2626 -S3BucketName my-docs-bucket \
2727 -CloudFrontDistributionId ABCD1234 \
28- -Versions 6.0 6.2 7.0 7.1 8.0
28+ -Versions " 6.0, 6.2, 7.0, 7.1, 8.0"
2929```
3030------------------------------------------------------------------------------!#>
3131
@@ -37,17 +37,14 @@ param(
3737 [Parameter (HelpMessage = ' CloudFront distribution ID to invalidate (optional)' )]
3838 [string ]$CloudFrontDistributionId ,
3939
40- [Parameter (ValueFromRemainingArguments = $false , HelpMessage = " Versions to regenerate Whats New for e.g. 6.0 7.0 8.0 " )]
41- [string []] $Versions = @ () ,
40+ [Parameter (HelpMessage = " Comma-separated versions to regenerate Whats New for e.g. ' 6.0,6.2, 7.0' " )]
41+ [string ] $Versions = " " ,
4242
4343 [Parameter (HelpMessage = ' Dry run mode. If enabled, no sync to S3 or CloudFront invalidation will occur.' )]
4444 [switch ]$DryRun
4545)
4646
47- # ---------------------------------------------------------------------------
48- # Constants & helpers
49- # ---------------------------------------------------------------------------
50- $PythonWhatsNewPath = Join-Path $PSScriptRoot ' build_whats_new.py' # script lives alongside this file
47+ $PythonWhatsNewPath = Join-Path $PSScriptRoot ' build_whats_new.py'
5148
5249function ThrowIfEmpty {
5350 param (
@@ -58,7 +55,7 @@ function ThrowIfEmpty {
5855}
5956
6057function Ensure-Dependencies {
61- Write-Host ' Verifying runtime dependencies… ' - ForegroundColor Cyan
58+ Write-Host ' Verifying runtime dependencies... ' - ForegroundColor Cyan
6259
6360 foreach ($cmd in ' node' , ' npm' , ' python' , ' aws' ) {
6461 if (-not (Get-Command $cmd - ErrorAction SilentlyContinue)) {
@@ -76,59 +73,44 @@ function Ensure-Dependencies {
7673
7774function Process-Changelogs {
7875 param (
79- [string []]$VersionsToBuild
76+ [string []]$WhatsNewVersions
8077 )
8178
82- if (-not $VersionsToBuild ) { return }
79+ if (-not $WhatsNewVersions ) { return }
8380
84- # Ensure API key exists before invoking Python helper
85- ThrowIfEmpty $Env: API_WEB_RAVENDB_NET_HOST ' API_WEB_RAVENDB_NET_HOST env var must be set when specifying versions'
81+ ThrowIfEmpty $Env: WHATS_NEW_URL ' WHATS_NEW_URL env var must be set when specifying versions'
8682
87- Write-Host " Generating *What's New* pages for versions: $ ( $VersionsToBuild -join ' , ' ) " - ForegroundColor Cyan
83+ $VersionsArray = $WhatsNewVersions.Split (' ,' ) | ForEach-Object { $_.Trim () } | Where-Object { $_ }
84+ Write-Host " Generating *What's New* pages for versions: $WhatsNewVersions " - ForegroundColor Cyan
8885
89- & python $PythonWhatsNewPath @VersionsToBuild
86+ & python $PythonWhatsNewPath @VersionsArray
9087 if ($LASTEXITCODE ) { throw ' build_whats_new.py failed' }
9188}
9289
93- # ---------------------------------------------------------------------------
94- # 0. Verify runtime dependencies
95- # ---------------------------------------------------------------------------
9690Ensure- Dependencies
9791
98- # ---------------------------------------------------------------------------
99- # 1. Validate AWS environment
100- # ---------------------------------------------------------------------------
10192ThrowIfEmpty $Env: AWS_ACCESS_KEY_ID ' AWS_ACCESS_KEY_ID not set'
10293ThrowIfEmpty $Env: AWS_SECRET_ACCESS_KEY ' AWS_SECRET_ACCESS_KEY not set'
10394ThrowIfEmpty $Env: AWS_DEFAULT_REGION ' AWS_DEFAULT_REGION not set'
10495
10596Write-Host " Region: '$Env: AWS_DEFAULT_REGION ' | Bucket: '$S3BucketName '" - ForegroundColor Cyan
10697
107- # ---------------------------------------------------------------------------
108- # 2. Validate API_WEB_RAVENDB_NET_HOST when versions are provided
109- # ---------------------------------------------------------------------------
110- if ($Versions.Count -gt 0 ) {
111- ThrowIfEmpty $Env: API_WEB_RAVENDB_NET_HOST ' API_WEB_RAVENDB_NET_HOST env var must be set when specifying versions'
98+ if ($Versions ) {
99+ ThrowIfEmpty $Env: WHATS_NEW_URL ' WHATS_NEW_URL env var must be set when specifying versions'
112100}
113101
114- # ---------------------------------------------------------------------------
115- # 3. Regenerate What's New (if requested)
116- # ---------------------------------------------------------------------------
117102Process - Changelogs - VersionsToBuild $Versions
118103
119- # ---------------------------------------------------------------------------
120- # 4. Install JS dependencies & build site
121- # ---------------------------------------------------------------------------
122- Write-Host ' Installing JS dependencies (npm ci)…' - ForegroundColor Cyan
104+ Write-Host ' Installing JS dependencies (npm ci)...' - ForegroundColor Cyan
123105$env: NODE_OPTIONS = ' --max-old-space-size=8192'
124106
125107if (-not (Test-Path package.json)) { throw ' package.json not found' }
126108
127109npm ci -- no- audit -- fund false
128110if ($LASTEXITCODE ) { throw ' npm ci failed' }
129111
130- Write-Host " Running 'npx docusaurus build --dev'… " - ForegroundColor Gray
131- npx docusaurus build -- dev
112+ Write-Host " Running 'npx docusaurus build'... " - ForegroundColor Gray
113+ npx docusaurus build
132114if ($LASTEXITCODE ) { throw ' Docusaurus build failed' }
133115
134116$BuildDir = Join-Path $PSScriptRoot ' build'
@@ -138,16 +120,10 @@ if ($DryRun) {
138120 Write-Host " Dry run mode enabled. Skipping sync to s3://$S3BucketName / and CloudFront invalidation." - ForegroundColor Yellow
139121} else {
140122
141- # ---------------------------------------------------------------------------
142- # 5. Sync build output to S3
143- # ---------------------------------------------------------------------------
144- Write-Host " Syncing to s3://$S3BucketName / …" - ForegroundColor Cyan
123+ Write-Host " Syncing to s3://$S3BucketName / ..." - ForegroundColor Cyan
145124 aws s3 sync $BuildDir " s3://$S3BucketName /" -- delete
146125 if ($LASTEXITCODE ) { throw ' aws s3 sync failed' }
147126
148- # ---------------------------------------------------------------------------
149- # 6. Invalidate CloudFront (optional)
150- # ---------------------------------------------------------------------------
151127 if ($CloudFrontDistributionId ) {
152128 Write-Host " Invalidating CloudFront distribution $CloudFrontDistributionId " - ForegroundColor Cyan
153129 aws cloudfront create- invalidation -- distribution- id $CloudFrontDistributionId -- paths ' /*' | Out-Null
0 commit comments