How to publish your charm to Charmhub
You’ve built your charm. You’ve also prepared a nice README file for your charm. You are now ready to share it with the world! This document shows you how you can publish it to the official charm repository, Charmhub.
Just like initialising and building your charm, publishing your charm can also be easily done using Charmcraft.
First, log in to Charmhub using Charmcraft:
$ charmcraft login Opening an authorization web page in your browser; if> See also: > - [How to build your charm](/t/how-to-build-your-charm/5548) > - [How to document your charm: The README file](/t/4463) it does not open, please open this URL: https://api.staging.jujucharms.com/identity/login?did=<id> Login successful.
charmcraft session will expire automatically, but you’ll be prompted to re-authenticate automatically next time you try to access a feature that requires interaction with Charmhub.
Then, register your charm’s name to your account:
$ charmcraft register my-awesome-charm Congrats! You are now the publisher of 'my-awesome-charm'
To make sure you pick a good name, see Charm naming guidelines.
You only need to register the name if you haven’t already registered it before. You can check which names you have already registered by running
Now, upload your charm:
charmcraft upload my-awesome-charm.charm Revision 1 of my-awesome-charm created
Every time a new binary is uploaded for a charm, a new revision is created on Charmhub. We can verify its current status easily by running
charmcraft revisions <charm-name>.
Finally, release your charm into a channel so it can become available for downloading:
$ charmcraft release my-awesome-charm --revision=1 --channel=beta Revision 1 of charm 'my-awesome-charm' released to beta
Only once the charm is released (to any channel) will Charmhub display the charm’s information at
charmhub.io/charm-name. The default information displayed is obtained from the most stable channel.
Just in case, also check your charm’s status:
$ charmcraft status my-awesome-charm Track Channel Version Revision latest stable - - candidate - - beta 0.1 1 edge ↑ ↑
If your charm is designed to work on Kubernetes, or otherwise requires the use of additional resources, there are additional steps required to upload the resources and attach them to a release. To find out more, see How to publish your charm’s resources.
Last updated 10 days ago.