Please note: that this approach uses Advance HTTP Operation pattern, which is not recommended by Microsoft, please read the disclaimer. However, in the time of writing this article there is no API or recommended approach, so it’s currently the only way to upload and automatically deploy a SPFx package.
You can find source code here
You can watch video here
The OOTB approach to add SPFx package to the tenant’s App Catalog.
All SharePoint Framework solutions deployed into a tenant must be approved by a user with full control permission set for the tenant’s App Catalog site via SharePoint UI.
This is done by uploading the SharePoint Framework package, the .sppkg file into the Apps for SharePoint library.
When a new solution is added to the library, the administrator receives a dialog popup requesting for consent to approve the solution tenancy wide. The dialog explains that this is a full trust client side code solution without any resource restrictions and that it executes under user’s context. The dialog also shows from what domain it will primarily get content, that is the CDN location of the SharePoint Framework scripts.
Once approved the SharePoint Framework solution can be enabled on any Site Collection within the tenant.