Skip to content
Snippets Groups Projects
release.md 4.11 KiB
Newer Older
  • Learn to ignore specific revisions
  • Bastien DUMONT's avatar
    Bastien DUMONT committed
    # Release Ecolyo to Cozy
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    !!! abstract "Procedure summary"
        - tag
        - build
        - deploy
        - publish
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    ## Pre-requisites
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    Make sure that:  
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    - 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
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    ## Bump versions, Tag and create changelog
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    ### manifest.webapp
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    Checkout on the branch `dev` and bump the version number in `manifest.webapp`.
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    !!! warning "Commit but don't push"
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        So pipelines are not yet triggered.
    
        Use a message such as _"bump manifest to X.Y.Z"_
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        You don't have to change the version inside `package.json`, standard-version will do it.
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    ### Tag with Standard-version
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    !!! question "Standard version"
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        [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)).
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    A release script is inside package.json, run it or use the standard-release command :
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    ```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
    
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    ??? bug "Handle mistake tags"
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        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.
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        You can list the annotated tag with the following command
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        ```sh
        git tag -n
        ```
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        A normal tag should have its related commit like this :
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        ```
        v2.1.3          chore(release): 2.1.3
        v2.2.0          chore(release): 2.2.0
        ```
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        If you see some mistakes in tag annotation you can change it with the following command :
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        ```sh
        git tag -a v2.1.3 COMMIT_SHA -m 'chore(release): 2.1.3' -f
        ```
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        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.
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    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.
    
    ## 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)
    
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    !!! note "You can also push the build manually"
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
        ```sh
        yarn build:browser
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        yarn deploy
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
        ```
    
    ## 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
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    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).
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    
    ## Update master
    
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    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).