CINXE.COM

Mix publish package | Hex

<!DOCTYPE html> <html lang="en" prefix="og: http://ogp.me/ns#"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="A package manager for the Erlang ecosystem"> <meta name="sogou_site_verification" content="GrtyJPARqi"/> <title>Mix publish package | Hex</title> <meta content="Mix publish package" property="og:title"><meta content="website" property="og:type"><meta property="og:url"><meta content="https://hex.pm/images/favicon-160-93fa091b05b3e260e24e08789344d5ea.png?vsn=d" property="og:image"><meta content="160" property="og:image:width"><meta content="160" property="og:image:height"><meta content="A package manager for the Erlang ecosystem" property="og:description"><meta content="Hex" property="og:site_name"> <meta content="JBY9BQk0K0ESPWEmRTcFAiI9eyo-aglRKrIKVkZu_X6hhyMwqkBzqRFg" name="csrf-token"> <link rel="search" type="application/opensearchdescription+xml" title="Hex" href="/hexsearch.xml"> <link rel="stylesheet" href="/assets/app-45e74e54911234615c7a64e5bbd83cbd.css?vsn=d"> <link rel="alternate" type="application/rss+xml" title="RSS - Blog" href="/feeds/blog.xml"> <script async defer data-domain="hex.pm" src="https://stats.hex.pm/js/plausible.js"></script> </head> <body> <!--[if lt IE 10]> <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> <section class="content-wrapper"> <nav class="navbar navbar-default"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/"> <img src="/images/hex-a56f59a0c6bb92a0e2850ccd555f7525.png?vsn=d" srcset="/images/hex-a56f59a0c6bb92a0e2850ccd555f7525.png?vsn=d 1x, /images/hex@2-844f591d7bbac6a50d895110a643c670.png?vsn=d 2x, /images/hex@3-b88c46c5ec4e807f1daef99e4dd1f231.png?vsn=d 3x" alt="hex logo"> </a> </div> <div id="navbar" class="navbar-collapse collapse"> <form class="navbar-form pull-left-non-mobile" role="search" action="/packages"> <div class="input-group"> <input placeholder="Find packages" name="search" type="text" class="form-control" value=""> <input type="hidden" name="sort" value="recent_downloads"> <div class="input-group-btn"> <button type="submit" class="btn btn-search" tabindex="1"> <svg aria-hidden="true" class="heroicon heroicon-magnifying-glass" fill="none" height="17" title="magnifying-glass" version="1.1" viewBox="0 0 24 24" width="17"><g title="magnifying-glass"><path d="M21 21L15.8033 15.8033M15.8033 15.8033C17.1605 14.4461 18 12.5711 18 10.5C18 6.35786 14.6421 3 10.5 3C6.35786 3 3 6.35786 3 10.5C3 14.6421 6.35786 18 10.5 18C12.5711 18 14.4461 17.1605 15.8033 15.8033Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /></g></svg> </button> </div> </div> </form> <ul class="nav navbar-nav navbar-right"> <li><a href="/packages">Packages</a></li> <li><a href="/pricing">Pricing</a></li> <li><a href="/docs">Docs</a></li> <li><a href="/login">Log in</a></li> </ul> </div><!--/.nav-collapse --> </div> </nav> <div class="container flash"> </div> <div class="container page docs"> <div class="row"> <div class="col-sm-3"> <ul class="sidebar"> <li class="sidebar-header">Mix</li> <li class="sidebar-item "><a href="/docs/usage">Usage</a></li> <li class="sidebar-item selected"><a href="/docs/publish">Publishing packages</a></li> <li class="sidebar-item "><a href="/docs/private">Private packages</a></li> <li class="sidebar-item"><a target="_blank" rel="noopener" href="https://hexdocs.pm/hex">Tasks <svg aria-hidden="true" class="heroicon heroicon-window" fill="none" height="24" title="window" version="1.1" viewBox="0 0 24 24" width="24"><g title="window"><path d="M3 8.25V18C3 19.2426 4.00736 20.25 5.25 20.25H18.75C19.9926 20.25 21 19.2426 21 18V8.25M3 8.25V6C3 4.75736 4.00736 3.75 5.25 3.75H18.75C19.9926 3.75 21 4.75736 21 6V8.25M3 8.25H21M5.25 6H5.2575V6.0075H5.25V6ZM7.5 6H7.5075V6.0075H7.5V6ZM9.75 6H9.7575V6.0075H9.75V6Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /></g></svg></a></li> <li class="sidebar-header">Rebar</li> <li class="sidebar-item "><a href="/docs/rebar3-usage">Usage</a></li> <li class="sidebar-item "><a href="/docs/rebar3-publish">Publishing packages</a></li> <li class="sidebar-item "><a href="/docs/rebar3-private">Private packages</a></li> <li class="sidebar-item"><a target="_blank" rel="noopener" href="https://rebar3.org/docs/package_management/hex_package_management/">Tasks <svg aria-hidden="true" class="heroicon heroicon-window" fill="none" height="24" title="window" version="1.1" viewBox="0 0 24 24" width="24"><g title="window"><path d="M3 8.25V18C3 19.2426 4.00736 20.25 5.25 20.25H18.75C19.9926 20.25 21 19.2426 21 18V8.25M3 8.25V6C3 4.75736 4.00736 3.75 5.25 3.75H18.75C19.9926 3.75 21 4.75736 21 6V8.25M3 8.25H21M5.25 6H5.2575V6.0075H5.25V6ZM7.5 6H7.5075V6.0075H7.5V6ZM9.75 6H9.7575V6.0075H9.75V6Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /></g></svg></a></li> <li class="sidebar-header">Hex</li> <li class="sidebar-item "><a href="/docs/faq">FAQ</a></li> <li class="sidebar-item "><a href="/docs/self-hosting">Self-hosting</a></li> <li class="sidebar-item "><a href="/docs/mirrors">Mirrors</a></li> <li class="sidebar-item "><a href="/docs/public-keys">Public keys</a></li> </ul> </div> <div class="col-sm-9"> <h2> Publishing a package</h2> <p> Publishing a package to Hex consists of registering a Hex user, adding metadata to the project’s <code class="inline">mix.exs</code> file, and finally submitting the package with a <code class="inline">mix</code> task.</p> <h3 id="registering-a-hex-user" class="section-heading"> <a href="#registering-a-hex-user" class="hover-link"> <svg aria-hidden="true" class="heroicon heroicon-link icon-link" fill="none" height="24" title="link" version="1.1" viewBox="0 0 24 24" width="24"><g title="link"><path d="M13.1903 8.68842C13.6393 8.90291 14.0601 9.19611 14.432 9.56802C16.1893 11.3254 16.1893 14.1746 14.432 15.932L9.93198 20.432C8.17462 22.1893 5.32538 22.1893 3.56802 20.432C1.81066 18.6746 1.81066 15.8254 3.56802 14.068L5.32499 12.311M18.675 11.689L20.432 9.93198C22.1893 8.17462 22.1893 5.32538 20.432 3.56802C18.6746 1.81066 15.8254 1.81066 14.068 3.56802L9.56802 8.06802C7.81066 9.82538 7.81066 12.6746 9.56802 14.432C9.93992 14.8039 10.3607 15.0971 10.8097 15.3116" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /></g></svg> </a> Registering a Hex user </h3> <p> When registering a user, you will be prompted for a username, your email and a password. The email is used to confirm your identity during signup, as well as to contact you in case there is an issue with one of your packages. The email will never be shared with a third party.</p> <pre><code class="nohighlight">$ mix hex.user register Username: johndoe Email: john.doe@example.com Password: Password (confirm): Registering... Generating API key... You are required to confirm your email to access your account, a confirmation email has been sent to john.doe@example.com</code></pre> <p> Once this step has been completed, check your email inbox for the confirmation email. Once you have followed the enclosed link, your account will be ready to use.</p> <h3 id="naming-your-package" class="section-heading"> <a href="#naming-your-package" class="hover-link"> <svg aria-hidden="true" class="heroicon heroicon-link icon-link" fill="none" height="24" title="link" version="1.1" viewBox="0 0 24 24" width="24"><g title="link"><path d="M13.1903 8.68842C13.6393 8.90291 14.0601 9.19611 14.432 9.56802C16.1893 11.3254 16.1893 14.1746 14.432 15.932L9.93198 20.432C8.17462 22.1893 5.32538 22.1893 3.56802 20.432C1.81066 18.6746 1.81066 15.8254 3.56802 14.068L5.32499 12.311M18.675 11.689L20.432 9.93198C22.1893 8.17462 22.1893 5.32538 20.432 3.56802C18.6746 1.81066 15.8254 1.81066 14.068 3.56802L9.56802 8.06802C7.81066 9.82538 7.81066 12.6746 9.56802 14.432C9.93992 14.8039 10.3607 15.0971 10.8097 15.3116" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /></g></svg> </a> Naming your package </h3> <p> Before publishing, you will have to choose the name of your package. Remember that packages published to Hex are public and can be accessed by anyone in the community. It is also the responsibility of the community to pick and encourage good package names. Here are some tips:</p> <ul> <li> Avoid using offensive or harassing package names, nicknames, or other identifiers that might detract from a friendly, safe, and welcoming environment for all. </li> <li> If you are providing functionality on top of an existing package, consider using that package name as a prefix. For example, if you want to add authentication to <a href="https://github.com/elixir-lang/plug">Plug</a>, consider calling your package <code class="inline">plug_auth</code> (or <code class="inline">plug_somename</code>) instead of <code class="inline">auth</code> (or <code class="inline">somename</code>). </li> <li> Avoid namespace conflicts with existing packages. Plug owns the <code class="inline">Plug</code> namespace, if you have an authentication package for Plug use the namespace <code class="inline">PlugAuth</code> instead of <code class="inline">Plug.Auth</code>. <ul> <li> This guidelines holds for all of your modules, so if your package is <code class="inline">plug_auth</code> then all of your modules (except for special ones like mix tasks) should start with <code class="inline">PlugAuth.</code> (e.g. <code class="inline">PlugAuth.Utils</code>, <code class="inline">PlugAuth.User</code>). This is important because there can only be one module with a given name running in a BEAM system, and if multiple packages define the same module, then you cannot use both packages because only one version of the module will be used. </li> </ul> </li> </ul> <p> With a name in hand, it is time to add the proper metadata to your <code class="inline">mix.exs</code> file.</p> <h3 id="adding-metadata-to-code-classinlinemixexscode" class="section-heading"> <a href="#adding-metadata-to-code-classinlinemixexscode" class="hover-link"> <svg aria-hidden="true" class="heroicon heroicon-link icon-link" fill="none" height="24" title="link" version="1.1" viewBox="0 0 24 24" width="24"><g title="link"><path d="M13.1903 8.68842C13.6393 8.90291 14.0601 9.19611 14.432 9.56802C16.1893 11.3254 16.1893 14.1746 14.432 15.932L9.93198 20.432C8.17462 22.1893 5.32538 22.1893 3.56802 20.432C1.81066 18.6746 1.81066 15.8254 3.56802 14.068L5.32499 12.311M18.675 11.689L20.432 9.93198C22.1893 8.17462 22.1893 5.32538 20.432 3.56802C18.6746 1.81066 15.8254 1.81066 14.068 3.56802L9.56802 8.06802C7.81066 9.82538 7.81066 12.6746 9.56802 14.432C9.93992 14.8039 10.3607 15.0971 10.8097 15.3116" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /></g></svg> </a> Adding metadata to <code class="inline">mix.exs</code> </h3> <p> The package is configured in the <code class="inline">project</code> function in the project’s <code class="inline">mix.exs</code> file. <a href="#example-mixexs-file">See below</a> for an example file.</p> <p> First, make sure that the <code class="inline">:version</code> property is correct. All Hex packages are required to follow <a href="http://semver.org/">semantic versioning</a>. While your package version is at major version “0”, any breaking changes should be indicated by incrementing the minor version. For example, <code class="inline">0.1.0 -&gt; 0.2.0</code>.</p> <p> Fill in the <code class="inline">:description</code> property. It should be a sentence, or a few sentences, describing the package.</p> <p> Under the <code class="inline">:package</code> property are some additional configuration options:</p> <dl class="dl-horizontal"> <dt><code>:name</code></dt> <dd>The name of the package in case you want to publish the package with a different name than the application name. By default this is set to the same as the name of your OTP application (having the same value as `project.app`), written in snake_case (lowercase with underscores as word separator).</dd> <dt><code>:organization</code></dt> <dd>The organization the package belongs to. The package will be published to the organization repository, defaults to the global <code>"hexpm"</code> repository.</dd> <dt><code>:licenses</code></dt> <dd>A list of licenses the project is licensed under. This attribute is required. Valid license identifiers are available from <a href="https://spdx.org/licenses/">SPDX</a>.</dd> <dt><code>:links</code></dt> <dd>A map where the key is a link name and the value is the link URL. Optional but highly recommended.</dd> <dt><code>:files</code></dt> <dd>A list of files and directories to include in the package. Defaults to standard project directories, so you usually don't need to set this property.</dd> <dt><code>:build_tools</code></dt> <dd>List of build tools that can build the package. It's very rare that you need to set this, as Hex tries to automatically detect the build tools based on the files in the package. If a <code>rebar</code> or <code>rebar.config</code> file is present Hex will mark it as able to build with rebar. This detection can be overridden by setting this field.</dd></dl> <p> To improve the documentation generated by ExDoc, the following fields can also be supplied as part of the <code class="inline">project</code> function:</p> <dl class="dl-horizontal"> <dt><code>:source_url</code></dt> <dd>An URL to the location where your source code is publicly available. This will be used to link directly to the code of the different modules functions from within the documentation.</dd> <dt><code>:homepage_url</code></dt> <dd>An URL to the homepage of your application. This will be used to link back to your homepage from within the generated documentation.</dd></dl> <p> Consult the <a href="https://github.com/elixir-lang/ex_doc#using-exdoc-with-mix">ExDoc documentation</a> for more information on improving the generated documentation.</p> <h4 id="dependencies" class="section-heading"> <a href="#dependencies" class="hover-link"> <svg aria-hidden="true" class="heroicon heroicon-link icon-link" fill="none" height="24" title="link" version="1.1" viewBox="0 0 24 24" width="24"><g title="link"><path d="M13.1903 8.68842C13.6393 8.90291 14.0601 9.19611 14.432 9.56802C16.1893 11.3254 16.1893 14.1746 14.432 15.932L9.93198 20.432C8.17462 22.1893 5.32538 22.1893 3.56802 20.432C1.81066 18.6746 1.81066 15.8254 3.56802 14.068L5.32499 12.311M18.675 11.689L20.432 9.93198C22.1893 8.17462 22.1893 5.32538 20.432 3.56802C18.6746 1.81066 15.8254 1.81066 14.068 3.56802L9.56802 8.06802C7.81066 9.82538 7.81066 12.6746 9.56802 14.432C9.93992 14.8039 10.3607 15.0971 10.8097 15.3116" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /></g></svg> </a> Dependencies </h4> <p> A dependency defined with no SCM (<code class="inline">:git</code> or <code class="inline">:path</code>) will be automatically treated as a Hex dependency. See the <a href="/docs/usage">Usage guide</a> for more details.</p> <p> Only Hex packages may be used as dependencies of the package. It is not possible to upload packages with Git dependencies. Additionally, only production dependencies will be included, just like how Mix will only fetch production dependencies when fetching the dependencies of your dependencies. Dependencies will be treated as production dependencies when they are defined with no <code class="inline">:only</code> property or with <code class="inline">only: :prod</code>.</p> <a id="example-mix-exs-file"></a><h4 id="documentation" class="section-heading"> <a href="#documentation" class="hover-link"> <svg aria-hidden="true" class="heroicon heroicon-link icon-link" fill="none" height="24" title="link" version="1.1" viewBox="0 0 24 24" width="24"><g title="link"><path d="M13.1903 8.68842C13.6393 8.90291 14.0601 9.19611 14.432 9.56802C16.1893 11.3254 16.1893 14.1746 14.432 15.932L9.93198 20.432C8.17462 22.1893 5.32538 22.1893 3.56802 20.432C1.81066 18.6746 1.81066 15.8254 3.56802 14.068L5.32499 12.311M18.675 11.689L20.432 9.93198C22.1893 8.17462 22.1893 5.32538 20.432 3.56802C18.6746 1.81066 15.8254 1.81066 14.068 3.56802L9.56802 8.06802C7.81066 9.82538 7.81066 12.6746 9.56802 14.432C9.93992 14.8039 10.3607 15.0971 10.8097 15.3116" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /></g></svg> </a> Documentation </h4> <p> Documentation is automatically published to <a href="https://hexdocs.pm">hexdocs.pm</a> when you publish your package. If you only want to publish the package itself you can run <code class="inline">mix hex.publish package</code>, similarly if you want to (re)publish the documentation of an existing package version you can run <code class="inline">mix hex.publish docs</code>.</p> <p> Before publishing documentation, Hex will build the documentation by running the <code class="inline">mix docs</code> task to make sure it is up to date. The main documentation tool for Elixir, <code class="inline">ex_doc</code> provides this task so if you add it as a dependency you don’t have to do anything else to get automatic documentation builds when you publish your package. Check out the <a href="https://hexdocs.pm/ex_doc/readme.html">documentation for ex_doc</a> for information on how to configure your docs, we recommend building your docs locally with <code class="inline">mix docs</code> before publishing them to Hex. Finally also take a look at the <a href="https://hexdocs.pm/elixir/writing-documentation.html">Elixir guide for writing documentation</a> for suggestions and best practices.</p> <p> If want to use another documentation tool or do post-processing on the build from ex_doc you can alias the <code class="inline">docs</code> task, check the <a href="https://hexdocs.pm/mix/Mix.html#module-aliases">task alias docs</a> for more information. Built documentation should be put in the <code class="inline">doc/</code> directory with at least an <code class="inline">index.html</code> file.</p> <h4 id="example-mixexs-file" class="section-heading"> <a href="#example-mixexs-file" class="hover-link"> <svg aria-hidden="true" class="heroicon heroicon-link icon-link" fill="none" height="24" title="link" version="1.1" viewBox="0 0 24 24" width="24"><g title="link"><path d="M13.1903 8.68842C13.6393 8.90291 14.0601 9.19611 14.432 9.56802C16.1893 11.3254 16.1893 14.1746 14.432 15.932L9.93198 20.432C8.17462 22.1893 5.32538 22.1893 3.56802 20.432C1.81066 18.6746 1.81066 15.8254 3.56802 14.068L5.32499 12.311M18.675 11.689L20.432 9.93198C22.1893 8.17462 22.1893 5.32538 20.432 3.56802C18.6746 1.81066 15.8254 1.81066 14.068 3.56802L9.56802 8.06802C7.81066 9.82538 7.81066 12.6746 9.56802 14.432C9.93992 14.8039 10.3607 15.0971 10.8097 15.3116" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /></g></svg> </a> Example mix.exs file </h4> <pre><code class="elixir">defmodule Postgrex.MixProject do use Mix.Project def project() do [ app: :postgrex, version: &quot;0.1.0&quot;, elixir: &quot;~&gt; 1.0&quot;, build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, description: description(), package: package(), deps: deps(), name: &quot;Postgrex&quot;, source_url: &quot;https://github.com/elixir-ecto/postgrex&quot; ] end def application() do [] end defp deps() do [ {:decimal, &quot;~&gt; 1.0&quot;}, {:ex_doc, &quot;~&gt; 0.14&quot;, only: :dev, runtime: false} ] end defp description() do &quot;A few sentences (a paragraph) describing the project.&quot; end defp package() do [ # This option is only needed when you don&#39;t want to use the OTP application name name: &quot;postgrex&quot;, # These are the default files included in the package files: ~w(lib priv .formatter.exs mix.exs README* readme* LICENSE* license* CHANGELOG* changelog* src), licenses: [&quot;Apache-2.0&quot;], links: %{&quot;GitHub&quot; =&gt; &quot;https://github.com/elixir-ecto/postgrex&quot;} ] end end</code></pre> <h3 id="submitting-the-package" class="section-heading"> <a href="#submitting-the-package" class="hover-link"> <svg aria-hidden="true" class="heroicon heroicon-link icon-link" fill="none" height="24" title="link" version="1.1" viewBox="0 0 24 24" width="24"><g title="link"><path d="M13.1903 8.68842C13.6393 8.90291 14.0601 9.19611 14.432 9.56802C16.1893 11.3254 16.1893 14.1746 14.432 15.932L9.93198 20.432C8.17462 22.1893 5.32538 22.1893 3.56802 20.432C1.81066 18.6746 1.81066 15.8254 3.56802 14.068L5.32499 12.311M18.675 11.689L20.432 9.93198C22.1893 8.17462 22.1893 5.32538 20.432 3.56802C18.6746 1.81066 15.8254 1.81066 14.068 3.56802L9.56802 8.06802C7.81066 9.82538 7.81066 12.6746 9.56802 14.432C9.93992 14.8039 10.3607 15.0971 10.8097 15.3116" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /></g></svg> </a> Submitting the package </h3> <p> After the package metadata and dependencies have been added to <code class="inline">mix.exs</code>, we are ready to publish the package with the <code class="inline">mix hex.publish</code> command:</p> <pre><code class="nohighlight">$ mix hex.publish Publishing postgrex v0.4.0 Dependencies: decimal ~&gt; 0.1.0 Excluded dependencies (not part of the Hex package): ex_doc Included files: lib/postgrex lib/postgrex/binary_utils.ex lib/postgrex/connection.ex lib/postgrex/protocol.ex lib/postgrex/records.ex lib/postgrex/types.ex mix.exs Proceed? [Yn] Y Published postgrex v0.4.0</code></pre> <p> Congratulations, you’ve published your package! It will appear on the <a href="https://hex.pm/">hex.pm</a> site and will be available to add as a dependency in other Mix projects.</p> <p> Please test your package after publishing by adding it as dependency to a Mix project and fetching and compiling it. If there are any issues, you can publish the package again for up to one hour after first publication. A publication can also be reverted with <code class="inline">mix hex.publish --revert VERSION</code>.</p> <p> When running the command to publish a package, Hex will create a tar file of all the files and directories listed in the <code class="inline">:files</code> property. When the tarball has been pushed to the Hex servers, it will be uploaded to a CDN for fast and reliable access for users. Hex will also recompile the registry file that all clients will update automatically when fetching dependencies.</p> <h3 id="publishing-from-ci" class="section-heading"> <a href="#publishing-from-ci" class="hover-link"> <svg aria-hidden="true" class="heroicon heroicon-link icon-link" fill="none" height="24" title="link" version="1.1" viewBox="0 0 24 24" width="24"><g title="link"><path d="M13.1903 8.68842C13.6393 8.90291 14.0601 9.19611 14.432 9.56802C16.1893 11.3254 16.1893 14.1746 14.432 15.932L9.93198 20.432C8.17462 22.1893 5.32538 22.1893 3.56802 20.432C1.81066 18.6746 1.81066 15.8254 3.56802 14.068L5.32499 12.311M18.675 11.689L20.432 9.93198C22.1893 8.17462 22.1893 5.32538 20.432 3.56802C18.6746 1.81066 15.8254 1.81066 14.068 3.56802L9.56802 8.06802C7.81066 9.82538 7.81066 12.6746 9.56802 14.432C9.93992 14.8039 10.3607 15.0971 10.8097 15.3116" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /></g></svg> </a> Publishing from CI </h3> <p> You can automate publishing packages from tools such as CI. You need a key with permissions to publish packages:</p> <pre><code class="nohighlight">$ mix hex.user key generate --key-name publish-ci --permission api:write Username: Account password: Generating key... f48ac236bca15c3271e077c15c5320c4</code></pre> <p> If you are publishing a package for your organization it is recommended to use a key for the organization instead of a personal key:</p> <pre><code class="nohighlight">$ mix hex.organization key acme generate --key-name publish-ci --permission api:write Local password: f48ac236bca15c3271e077c15c5320c4</code></pre> <p> Set the key in the <code class="inline">HEX_API_KEY</code> system environment variable. To publish the package without being prompted pass the <code class="inline">--yes</code> flag:</p> <pre><code class="nohighlight">$ HEX_API_KEY=f48ac236bca15c3271e077c15c5320c4 mix hex.publish --yes</code></pre> <p> <em>Note that care should be used when automating publishing because Hex can output important warnings or even recommendations on how to improve your package that will easily be missed when the process is automated. Also note that Hex is still pre 1.0 so breaking changes can happen between any releases and CI will usually install the latest version.</em></p> </div> </div> </div> </section> <div class="footer"> <div class="footer-nav"> <div class="container"> <div class="row"> <div class="col-md-3"> <h4>About Hex</h4> <ul> <li><a href="/about">About</a></li> <li><a href="/blog">Blog</a></li> <li><a href="/sponsors">Sponsors</a></li> <li><a href="https://github.com/hexpm">GitHub</a></li> <li><a href="https://twitter.com/hexpm">Twitter</a></li> <li><a href="https://status.hex.pm">Status</a></li> </ul> </div> <div class="col-md-3"> <h4>Help</h4> <ul> <li> <a href="/docs">Documentation</a> (<a href="/docs/faq">FAQ</a>) </li> <li><a href="https://github.com/hexpm/specifications">Specifications</a></li> <li><a href="https://github.com/hexpm/hex/issues">Report Client Issue</a></li> <li><a href="https://github.com/hexpm/hexpm/issues">Report General Issue</a></li> <li><a href="mailto:security@hex.pm">Report Security Issue</a></li> <li><a href="mailto:support@hex.pm">Contact Support</a></li> </ul> </div> <div class="col-md-3"> <h4>Policies and Terms</h4> <ul> <li><a href="/policies/codeofconduct">Code of Conduct</a></li> <li><a href="/policies/termsofservice">Terms of Service</a></li> <li><a href="/policies/privacy">Privacy Policy</a></li> <li><a href="/policies/copyright">Copyright Policy</a></li> <li><a href="/policies/dispute">Dispute Policy</a></li> </ul> </div> <div class="col-md-3 copyright"> <p>2020 © Six Colors AB.</p> <p>Powered by the <a href="https://www.erlang.org/">Erlang VM</a> and the <a href="https://elixir-lang.org/">Elixir programming language</a>.</p> </div> </div> </div> </div> </div> <script src="/assets/app-049c3224d12a8825ae812b9d2cf84de6.js?vsn=d"></script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10