What are you trying to publish? If you want to publish a map, you need to create a service definition first. You can step through the normal publishing process, and instead of publishing to a server or online, you can write out a SD file. Then you can publish this file. Make sure you author this file for publishing to online. There are differences between SD files authored for ArcGIS Server and those authored for ArcGIS Online.
Thanks,
Mike