Simple, if you're deploying WSP solution packages. Then you can just create, deploy and activate a web application scoped feature using the feature.xml outlined below. Define your custom actions in the CustomActions.xml file.
<?xml version="1.0" encoding="utf-8"?>
<ElementManifest Location="CustomActions.xml" />
Server side deployments are no longer recommended for new applications. Hence, you should also consider these options for deploying your custom actions:
- Create and deploy a SharePoint App that registers the custom actions. The app can be deployed to a site collection or globally through the App Catalog site.
- Use PowerShell scripting to deploy the custom action(s) to all applicable site collections. Leverage the Add-PnPCustomAction cmdlet from SharePoint Patterns and Practices (PnP).
The PnP PowerShell can run remote, works with SharePoint online and on-premises. I recommend this option the most.