Publishes a document by adding it to the umbraco.config file, prior to this the document should be marked published by calling Document.Publish(User u) on the document object.
Example
//...
using umbraco;
using umbraco.cms.businesslogic.web;
//...
//Create new DocumentObject
Document doc = new Document(id);
//Mark the document for publish under Admin account
doc.Publish(new User(0));
//Publish the document by Updating umbraco.config file
library.UpdateDocumentCache(doc.Id);