-
Notifications
You must be signed in to change notification settings - Fork 2
/
O365CDN.ps1
31 lines (24 loc) · 1.3 KB
/
O365CDN.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#################
# O365CDN.ps1 #
#################
#################
# Variables #
#################
# CDN SPO site #
$cdnSite = "https://praveenbattula.sharepoint.com/sites/praveen"
$cdnLib = "assets/SPFx" # => Document library and eventual folders
Write-Host ************************************************************************************** -ForegroundColor Yellow
Write-Host * Reading the cdnBasePath from write-manifests.json and collectiong the bundle files * -ForegroundColor Yellow
Write-Host ************************************************************************************** -ForegroundColor Yellow
$cdnConfig = Get-Content -Raw -Path .\config\copy-assets.json | ConvertFrom-Json
$bundlePath = Convert-Path $cdnConfig.deployCdnPath
$files = Get-ChildItem $bundlePath\*.*
Write-Host **************************************** -ForegroundColor Yellow
Write-Host Uploading the bundle on Office 365 CDN * -ForegroundColor Yellow
Write-Host **************************************** -ForegroundColor Yellow
Write-Host Connecting to SPO
Connect-PnPOnline $cdnSite -Credentials:spoCredentials
foreach ($file in $files) {
$fullPath = $file.DirectoryName + "\" + $file.Name
Add-PnPFile -Path $fullPath -Folder $cdnLib
}