This is what you may want to do (add the following code to your theme functions.php file or a custom plugin):
function add_custom_role() {
global $wp_roles;
$custom_capabilities = array(
'read', 'edit_posts', 'upload_files',
'read_private_pages', 'edit_private_pages', 'read_private_posts',
'edit_private_posts', 'edit_published_pages', 'edit_others_pages',
'edit_pages', 'edit_published_posts', 'edit_others_post',
'unfiltered_html', 'manage_options'
);
$wp_roles->add_role( 'custom_role', 'Custom Role', $custom_capabilities );
}
add_action( 'init', 'add_custom_role' );
References:
https://wordpress.org/support/article/roles-and-capabilities/
http://www.wphardcore.com/2010/ultimate-guide-to-roles-and-capabilities/
and a more modern article from a suggested edit:
https://kinsta.com/blog/wordpress-user-roles/