Cozy App Publish

What’s cozy-app-publish?

cozy-app-publish is a command line tool that publish a Cozy application to the Cozy registry according to some options.



yarn add --dev cozy-app-publish

Registry documentation

You can find more information about the registry and how to prepare an application to be published in the official registry documentation.

First of all, don’t forget to build the application:

# build the application (in the ./build folder here)
yarn build

Then, just publish it using the Travis CI workflow:

# publish it, REGISTRY_TOKEN should be
# encrypted and provided via Travis CI environment
# BUILD_COMMIT is your last build commit hash (git rev-parse build)
yarn cozy-app-publish \
--build-commit $BUILD_COMMIT

First of all, don’t forget to build the application:

# build the application (in the ./build folder here)
yarn build

Then, just publish it using:

yarn cozy-app-publish \
--build-url \
--manual-version 1.0.2-dev.042cef26d9d33ea604fe4364eaab569980b500c9


--token <editor-token> (required)

The registry editor token. This token must match the editor name and is provided by Cozy Cloud (with the name) in order to use the registry.

--build-dir <relative-path>

The path to the build folder, relative to the current directory. Since the ‘standard’ Cozy application builds in the build/ folder, build is the default value. This folder is mainly used to read the application manifest during publishing.

--build-url <url>

For now, the registry a build archive (.tar.gz file) from an external link to be used in the cozy-stack. In the travis script, this url is computed using the Github trick to get archives from a commit url (but it’s overwritten if provided by this option). For the manual script, we have to provide it.

--build-commit <commit-hash>

Using the travis mode, the archive tarball URL is computed using github and the build commit hash. If you are not on your build branch to publish, you can specify the correct build commit hash using this parameter.

--manual-version <version> (required for manual usage only)

In the manual mode, we don’t have a way to compute the version like in the Travis mode for example. So we have to provide it using this option.

--prepublish <script_path>

Specify custom prepublish hook to manage how the app archive is generated and uploaded. The script must export a asynchronous function which has the following signature:

module.exports = async ({
}) => {
 // ...

This function must return an object containing the same options given as parameter, which can have been updated. For example, you may specifiy a new appBuildUrl in the hook. Here’s a description of the different options:

Options Description
appBuildUrl The url where the build can be retrieved. For example,
appSlug The slug of the application, as defined in the manifest. Should not be mutated
appType webapp or konnector
appVersion App version, as defined in the manifest. Should not be mutated.
buildCommit sha of the commit, should not be mutated.
registryUrl URL of the Cozy registry, should not be mutated.
registryEditor Editor as it appears in the Cozy registry.
registryToken Registry Token. See registry documentation. Should not be mutated.
spaceName Space name in the Cozy registry.

--postpublish <script_path>

Works exactly like the prepublish option, but will be executed after the publication.

Multiple hooks and built-in hooks

You can specify more than one hook by separating them with a ,:

cozy-app-publish --prepublish <hook_name>,<other_hook_name>

Some hooks are shipped with cozy-app-publish and can be used by specifying their name:

cozy-app-publish --prepublish <builtin_hook_name>
Downcloud prepublish hook
cozy-app-publish --prepublish downcloud

This hook allows to upload the app to our downcloud server and sets the appBuildUrl accordingly.

In order to upload files to our downcloud server, you will need to generate a new pair of RSA keys, add the private key to your ssh-agent and make sure the corresponding public key is present on the downcloud server. Here’s how to do it:

- if [ "$TRAVIS_SECURE_ENV_VARS" != "false" ]; then eval "$(ssh-agent -s)"; fi
- if [ "$TRAVIS_SECURE_ENV_VARS" != "false" ]; then chmod 600 id_rsa_downcloud_myapp;
- if [ "$TRAVIS_SECURE_ENV_VARS" != "false" ]; then ssh-add id_rsa_downcloud_myapp;
Rundeck postpublish hook
cozy-app-publish --postpublish rundeck

Deploys the app on rundeck. This hook requires several variables to be set as environment variables:

Mattermost postpublish hook
cozy-app-publish --postpublish mattermost

Sends a message to a mattermost channel to notify of the app’s deployment. Requires the following options:

--registry-url <url>

The url of the registry, by default it will be

--space <space-name>

Use this options to provide a specific space name of the registry to publish the application in. By default it will be published in the default space.


To print more logs when using tool (useful for debug).

Day to day

Release workflow