Skip to content
Snippets Groups Projects
release.mdx 4.18 KiB
Newer Older
---
description: This guide helps you release a new version to Cozy.
---

# Release Ecolyo to Cozy
:::info Procedure summary

- tag
- build
- deploy
- publish

:::
## Pre-requisites
Make sure that:
- you are on the right branch (dev or master)
- your branch is up to date
- you node modules are up to date
Bastien DUMONT's avatar
Bastien DUMONT committed
- the prod build is successful
## Bump versions, Tag and create changelog
### manifest.webapp
Bastien DUMONT's avatar
Bastien DUMONT committed
Checkout on the branch `dev` and bump the version number in `manifest.webapp`.
:::warning Commit but don't push
So pipelines are not yet triggered.
Use a message such as _"bump manifest to X.Y.Z"_
You don't have to change the version inside `package.json`, standard-version will do it.
:::
### Tag with Standard-version
:::note Standard version
[Standard-version](https://github.com/conventional-changelog/standard-version) is library that facilitates creating tags and update changelog (it uses conventional commit so make sure you follow the guidelines described [here](./gitflow.md#conventional-commit)).
:::
A release script is inside package.json, run it or use the standard-release command :
```sh
yarn release 2.X.Y
# Equivalent to
yarn standard-version 2.X.Y
Bastien DUMONT's avatar
Bastien DUMONT committed
:warning: Do not push with VS Code :warning:
Bastien DUMONT's avatar
Bastien DUMONT committed
The script will give you a command to push tags on the remote (depending on the branch).
Bastien DUMONT's avatar
Bastien DUMONT committed
```sh
git push --follow-tags origin dev
```
Bastien DUMONT's avatar
Bastien DUMONT committed

<details>
  <summary>Handle mistake tags</summary>
  <div> 
  If you see a bug in the Changelog (the last version doesn't compare without the previous version correctly or you have plenty of undesired commits from previous versions), it means you made something wrong when you pushed your commit (basically you may have made a classical git push instead of git push --follow-tags origin dev), and you tag is not correctly annotated or annotated with the wrong commit.
    You can list the annotated tag with the following command
    ```sh
    git tag -n
    ```
    A normal tag should have its related commit like this :
    ```
    v2.1.3          chore(release): 2.1.3
    v2.2.0          chore(release): 2.2.0
    ```
    If you see some mistakes in tag annotation you can change it with the following command :
    ```sh
    git tag -a v2.1.3 COMMIT_SHA -m 'chore(release): 2.1.3' -f
    ```
    This command will annotate an existing tag (v2.1.3 with chore(release): 2.1.3 here) to the right commit. You'll have to pass the commit_sha from the related chore commit.

## Create a release

[Changelog.md](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/ecolyo/-/blob/dev/CHANGELOG.md) will be updated with commits of the current version.
To create a release, copy the content of the latest version bump and go to [Repository > Tags](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/ecolyo/-/tags) and click the edit button. Paste the version changelog inside the _Release notes_ and click create.

Rémi PAILHAREY's avatar
Rémi PAILHAREY committed
## Update master

Once you're finish, you should create a [new merge request](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/ecolyo/-/merge_requests/new#) from dev to master (without squashing commits).

## Deploy build

After pushing your tag, the pipelines should be triggered.

Verify that the **build** branch is up to date [Repository > Branches](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/ecolyo/-/branches)

:::note You can also push the build manually
```sh
yarn build:browser
yarn deploy
```

:::

## Publish build branch to Cozy

You can deploy content of build branch into Cozy registry by using the cozy-app-publish command after replacing following value:

- **$COZY_TOKEN**: token provided by Cozy team
- **$VERSION_NUMBER**: version of the application
- **$COZY_SPACE**: space of the Cozy

:warning: Make sure that the **build branch** is up to date and was build with **prod configuration**
Bastien DUMONT's avatar
Bastien DUMONT committed
```sh
yarn cozy-app-publish \
--token $COZY_TOKEN \
--build-url https://forge.grandlyon.com/web-et-numerique/factory/llle_project/ecolyo/-/archive/build/ecolyo-build.tar.gz \
--manual-version $VERSION_NUMBER \
--space $COZY_SPACE
Bastien DUMONT's avatar
Bastien DUMONT committed
You can now ping cozy so they ship the version.

More information at [cozy-app-publish](https://docs.cozy.io/en/cozy-app-publish/#manual-usage-not-recommended).