The sample provide a Powershell script to include in your SharePoint Framework solution which allow to have an automated deployment on Office 365 CDN
In order to use properly this script, is necessary install the PnP Powershell
-
Include the powershell files DeploySPFxToO365CDN.ps1 and DeploySPFxToAppCatalog.ps1 directly into the root of your SharePoint Framework solution. The first file uploads the SPFx bundle on Office 365, the second uploads and deploys the sppkg into the App Catalog.
-
Run the following commands in order to download the Powershell scripts:
Save-Script -Name VSTS.DeploySPFxToO365CDN -Path <root SPFx path>
Save-Script -Name VSTS.DeploySPFxToAppCatalog -Path <root SPFx path>
-
Setup the Office 365 CDN url
cdnBasePath
in thewrite-manifest.json
. -
Fill out the parameters contained in the configuration comments of DeploySPFxToO365CDN.ps1 and DeploySPFxToAppCatalog.ps1:
Parameter Value $cdnSite https:// <tenant>
.sharepoint.com/...$cdnLib <Document Library Name>
$catalogSite https:// <tenant>
.sharepoint.com/... -
Run
gulp bundle --ship
-
Run
gulp package-solution --ship
-
Run DeploySPFxToO365CDN.ps1, set the windows credential manager on your machine to avoid the Office 365 login everytime. more detail here
-
Run DeploySPFxToAppCatalog.ps1 and your SPFx solution is ready to go
You can also include these scripts in your TFS and configure properly the variables about the release definitions
In order to configure the continuous integration and deployment on Visual Studio Team Services, follow the steps on my blog post
use the following files:
- VSTS.DeploySPFxToAppCatalog.ps1
- VSTS.DeploySPFxToO365CDN.ps1