*********************************************************************
* THE ULTIMATE HITCHHIKER'S GUIDE TO THE TEST CAFE RELEASE WORKFLOW *
*********************************************************************


1. Prepare repository
=====================

    1.1 Create a new branch (for major releases only)
    -------------------------------------------------
        For major releases we need to create a new branch which will be treated as a release branch.
        Therefore all further work on minor releases should be done in this new branch.

        To create a new release branch:
            - Create a new file (let's name it 'new_branch') in the project root.
            - In TortoiseHg Workbench click on bold "Branch: {current_branch}" label above commit message textarea.
            - Click "Open a new named branch" radio-button and type new branch name (e.g. 15_1, 15_2).
            - Commit changes.
            - Now delete 'new_branch' file and commit once again.


    1.2 Set build labels
    --------------------
        Build system uses commit which is marked with major version label (e.g. 13_1, 14_1, 14_2).

        To set a build label:
            - Left click on commit in TortoiseHg Workbench
            - Choose "Tag..." from context menu.
            - In opened dialog check "Replace existing tag (-f/--force)" in options
            - In text box above choose appropriate label (or type a new one if it's doesn't exist yet)
            - Press "Move/Add" button.

        In addition to the build label you should set current minor version label to commit
        (e.g. 13_1_4, 14_1_1, 14_1_2). This will help determine release commit when build label will be moved for
        another release.


2. Prepare build system configuration
=====================================

    2.1 Configure installer
    -----------------------
        In the following files in DXVCS:

            $/CCNetConfig/LocalProjects/TestingTools/release/BuildLabel/DXBuild.Build.xml
            $/CCNetConfig/LocalProjects/TestingTools/release/Build/DXBuild.Build.xml
            $/CCNetConfig/LocalProjects/TestingTools/default/Build/DXBuild.Build.xml

        update tags:

            <Version>{minor_version}</Version>
            <ProductVersionSuffix>{version_suffix}</ProductVersionSuffix>

        there:

            {minor_version} - full version in semver format (e.g. 14.1.4, 15.1.1)
            {version_suffix} - major version prefixed with ".v" (e.g. .v14.1, .v15.2)


    2.2 Change release label configuration
    --------------------------------------
        In the following file in DXVCS:

            $/CCNetConfig/LocalProjects/TestingTools/release/BuildLabel/ConfigurationInfo.xml

        update tag:

            <VSSOption Database="repo=\\hg.corp.devexpress.com\repos\Salt;revset=tag({label})" Type="hg"/>

        there:

            {label} - release label which will be used for the release build (e.g. 14_1, 15_2).
                      See "1.2 Setting labels".


    2.3 Change daily builds branch configuration (for major releases only)
    ----------------------------------------------------------------------
         In the following file in DXVCS:

            $/CCNetConfig/LocalProjects/TestingTools/release/Build/ConfigurationInfo.xml

         update tag:

            <VSSOption Database="repo=\\hg.corp.devexpress.com\repos\Salt;revset=branch({branch})" Type="hg"/>

         there:

            {branch} - release branch which will be used for the daily builds (e.g. 14_1, 15_2).
                       See "1.1 Creating a new branch".


3. Prepare project files
========================

    3.1 Update "package.json"
    -------------------------
        "package.json" file can be found into the project root directory. Update it's "version" field.


    3.2 Update EULA
    ---------------
        If there were new open-source dependencies added to the project or some law-related changes occurred you
        should modify EULA file in the following locations:

            {project_root}/docs/TESTCAFE_EULA.txt
            \\corp\builds\release\DXBuild\Release\Binaries.v3\EULA_TESTCAFE.txt

        You should update

            {project_root}/runners/mac/TestCafe.mpkg/Contents/distriution.dist

        file as well, since it's contains EULA. Note that "\" is used as the new line-separator in this file.


    3.3 Update year in copyright
    ----------------------------
        Ensure that the ending year in the copyrights is the current year. E.g.:

            "Copyright (C) 2012-2015 Developer Express Inc."
                                ^
                        this should be current year

        Files to update:
            all EULA files (see "3.2 Update EULA")
            {project_root}/docs/README_NPM.txt


4. Get distributives
====================

   - Trigger "Build.TestCafe.Label ({version_label} tag)" task in DXCCTray. Wait till task complete.
   - Get latest distributives from:

        Distributive path                                          |       Target OS
        -----------------------------------------------------------+------------------------
        {build_dir}/Installations/DevExpressTestCafe-{version}.exe |        Windows
        -----------------------------------------------------------+------------------------
        {build_dir}/DevExpressTestCafe-Linux32-{version}.tgz       |      Linux 32bit
        -----------------------------------------------------------+------------------------
        {build_dir}/DevExpressTestCafe-Linux64-{version}.tgz       |      Linux 64bit
        -----------------------------------------------------------+------------------------
        {build_dir}/DevExpressTestCafe-MacOS-{version}.tgz         |         MacOS
        -----------------------------------------------------------+------------------------

     there {build_dir} is:
        \\corp\builds\release\Build.Release.TESTCafe.Label\TESTCafe.Release\{build_date}



5. Publish release
==================

    5.1 Publish new distributives on website (ask high-level support engineers)

    5.2 Publish "What's new" (ask technical writers)

    5.3 Rollout updates to testcafe.devexpress.com (ask website maintainers)

    5.4 Publish to NPM
    ------------------
        - Update your local repository to release label revision
        - Run "Distributive" gulp task
        - Open console and type:

            $ cd {your_project_path}/_dist_/npm

        - Login into NPM account:

            $ npm login

          with
               username: devexpress
               password: d10d306e-dccd-44d3-b135-78260e4eff2f

        - Ensure what you are logged into devexpress account:

            $ npm whoami

         It should write "devexpress"

        - Run publishing:

            $ npm publish



