Add Publishing options to custom entity
In 8.3 there is now an interface for this:


  Content entities that need a published/unpublished flag base field are
  now able to declare a "published" entity key in their entity type
  annotation. Such entities should implement the new
  \Drupal\Core\Entity\EntityPublishedInterface and use the
  \Drupal\Core\Entity\EntityPublishedTrait trait. The interface can be
  implemented directly, by the entity class, or by the entity
  specialised interface.

use Drupal\Core\Entity\EntityPublishedInterface;
use Drupal\Core\Entity\EntityPublishedTrait;
use ...

/**
 * @ContentEntityType(
 *   id = "custom_entity",
 *   ...
 *   entity_keys = {
 *     "id" = "id",
 *     "published" = "status",
 *     "label" = "label",
 *   },
 *   ...
 * )
 */
class CustomEntity extends ContentEntityBase implements CustomEntityInterface, EntityPublishedInterface {
  use EntityPublishedTrait;
   ...
}

  
  Entities defined in this way can benefit of the new provided methods
  to set the published status ON/OFF and are able to inspect the status
  of the published flag field:

$storage = \Drupal::entityTypeManager()-&gt;getStorage('custom_entity');
$entity = $storage-&gt;load(123);

// Reverse the published status.
if ($entity-&gt;isPublished()) {
  $entity-&gt;setUnpublished();
}
else {
  $entity-&gt;setPublished();
}

$entity-&gt;save()



Source: https://www.drupal.org/node/2830201

If you are developing for 8.4 you can use the base class


  EditorialContentEntityBase - a new base entity class for revisionable and publishable entity types
  
  Drupal 8.4.0 increases its usage of the revisioning and publishing
  features from Entity API by converting some if its most widely used
  content entity types: Taxonomy terms, Menu links, Comments, etc.
  
  In order to reduce code duplication and boilerplate, a new content
  entity base class is now available for entity types that want to
  support those features by default: EditorialContentEntityBase.
  
  If you are defining a content entity type in a contributed module or
  in your project's custom code, it is recommended to extend the
  \Drupal\Core\Entity\EditorialContentEntityBase base class in order to
  get out-of-the-box support for Entity API's revisioning and publishing
  features, which will allow your entity type to be used with Drupal's
  editorial workflow provided by the Content Moderation module.


Source: https://www.drupal.org/node/2870643