How to publish your charm on Charmhub

See also:

This document shows how to publish your charm to the official repository of charms, Charmhub.

Contents:

  1. Log in to Charmhub
  2. Register your charm’s name
  3. Upload the charm
  4. Release the charm
  5. Promote a charm revision to a lower risk level of the same track

Log in to Charmhub

To log into Charmhub, run charmcraft login:

$ charmcraft login
Opening an authorization web page in your browser.
If it does not open, please open this URL:
...

See more: charmcraft login

Your 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.

Register your charm’s name

To register your charm’s name to your account, choose a suitable name and then run the charmcraft register command followed by your desired charm name:

$ charmcraft register my-awesome-charm
Congrats! You are now the publisher of 'my-awesome-charm'

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 charmcraft names. See more: charmcraft names.

See more: charmcraft register, Charm naming guidelines

Upload the charm

To upload the charm, use the charmcraft upload command followed by the your charm’s filepath.

charmcraft upload my-awesome-charm.charm
Revision 1 of my-awesome-charm created

See more: charmcraft upload

If your metadata.yaml lists any resources: Those did not get packed with charmcraft pack, so they didn’t get uploaded with charmcraft upload <charm> either. Make sure to upload them as well! See more: How to publish a resource on Charmhub.

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>. See more: charmcraft revisions.

Release the charm

See also: charmcraft release, charmcraft status

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

Uploaded charms are not automatically released and made available for download. To consume a charm, first release it into a channel (any channel). Then Charmhub will 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       ↑          ↑

Promote a charm revision to a lower risk level of the same track

See also: Promotion

There is currently no easy way to accomplish this with Charmcraft (though there is a feature request in progress: link). At present we recommend you use the GitHub promote-charm action.

See more: GitHub | canonical/charming-actions/promote-charm


Contributors: @facundo , @jnsgruk , @lucabello , @pmatulis, @ppasotti, @sed-i , @tmihoc , @toto

Last updated 13 days ago. Help improve this document in the forum.