Merge duplicate code for publish of http&https and convert them to publish steps