Here’s a pretty simple one that I’m sure has been covered before but I decided to post my own version. It adds a sidebar for a custom post type and replaces the primary sidebar on that custom post type (singular posts).
Note that for the second half of this snippet (replacing the Primary Sidebar), I am assuming you are pasting it into a single template for your custom post type. If you are not and, instead, will be placing this snippet in your functions.php, it will need to be slightly modified. Otherwise, it will replace your Primary Sidebar globally.