|
| 1 | +# Making Releases |
| 2 | + |
| 3 | +- [Introduction](#introduction) |
| 4 | +- [Regular or Hotfix?](#regular-or-hotfix) |
| 5 | +- [Github and Git steps](#github-and-git-steps) |
| 6 | +- [Run Tests](#run-tests) |
| 7 | +- [Publish the Dataverse Client Javascript package](#publish-the-dataverse-client-javascript-package) |
| 8 | +- [Merge "release branch" into "main"](#merge-release-branch-into-main) |
| 9 | +- [Merge "main" into "develop"](#merge-main-into-develop) |
| 10 | + |
| 11 | +## Introduction |
| 12 | + |
| 13 | +This document is about releasing a public version of the dataverse-client-javascript package to the npm registry. |
| 14 | + |
| 15 | +## Regular or Hotfix? |
| 16 | + |
| 17 | +Early on, make sure it’s clear what type of release this is. The steps below describe making both regular releases and hotfix releases. Suppose the current version is 1.0.0. |
| 18 | + |
| 19 | +- Regular |
| 20 | + - e.g. 1.1.0 (minor) |
| 21 | + - e.g. 2.0.0 (major) |
| 22 | +- Hotfix |
| 23 | + - e.g. 1.1.1 (patch) |
| 24 | + |
| 25 | +## Github and Git steps |
| 26 | + |
| 27 | +First of all create an issue on Github to prepare the release, name it Release vX.X.X . |
| 28 | + |
| 29 | +On your local, create the release branch from the latest from develop and name it release/X.X.X . |
| 30 | + |
| 31 | +## Run Tests |
| 32 | + |
| 33 | +Let's check that all tests are passing by running `npm run test`. If everything is OK you can continue with the next step. |
| 34 | + |
| 35 | +## Publish the Dataverse Client Javascript package |
| 36 | + |
| 37 | +Dataverse Client Javascript is [published](https://www.npmjs.com/package/@iqss/dataverse-client-javascript) to the npm Package Registry. Below are the steps for publishing a new version. |
| 38 | + |
| 39 | +1. **Build the package** |
| 40 | + |
| 41 | + Now we need to build the package by running `npm run build`, after that you will see a `dist` folder in the root of the project. If you are not sure that folder was there already you can delete it and run the build command again. |
| 42 | + |
| 43 | +2. **Update the version** |
| 44 | + |
| 45 | + To update the version run the command `npm version <X.X.X> -m "dataverse-client-javascript-v%s"`. So if we are releasing version `3.5.0` the command will be: |
| 46 | + |
| 47 | + ```shell |
| 48 | + npm version 3.5.0 -m "dataverse-client-javascript-v%s" |
| 49 | + ``` |
| 50 | + |
| 51 | + This command will update the version in the `package.json` and `package-lock.json`, create a commit and a tag named `dataverse-client-javascript-v3.5.0`. |
| 52 | + |
| 53 | + If everything looks good, you can push the changes to the repository. |
| 54 | + |
| 55 | + ```shell |
| 56 | + git push && git push --tags |
| 57 | + ``` |
| 58 | + |
| 59 | +3. **Review the new tag in GitHub** |
| 60 | + |
| 61 | + After pushing the changes, you can review the new tag in the [GitHub repository](https://github.com/IQSS/dataverse-client-javascript/tags). |
| 62 | + |
| 63 | + The tag should be created with the new version. |
| 64 | + |
| 65 | +4. **Publish the package** |
| 66 | + |
| 67 | + After the version is updated, you can publish the package running the next command: |
| 68 | + |
| 69 | + ```shell |
| 70 | + npm publish --access public |
| 71 | + ``` |
| 72 | + |
| 73 | + This command will publish the package to the npm registry. |
| 74 | + |
| 75 | + Remember that you need a valid npm token to publish the package and be part of the @iqss organization on npm. |
| 76 | + |
| 77 | + Get a new token from the npm website and update the `.npmrc` file with the new token. If you don't have yet an `.npmrc` file, go to the project directory root, duplicate `.npmrc.example`, saving the copy as `.npmrc`. |
| 78 | +
|
| 79 | + Open the `.npmrc` file and replace `YOUR_NPM_TOKEN ` with your actual npm token. |
| 80 | +
|
| 81 | + ```plaintext |
| 82 | + //registry.npmjs.org/:\_authToken=<YOUR_NPM_AUTH_TOKEN> |
| 83 | + @iqss:registry=https://registry.npmjs.org/ |
| 84 | + ``` |
| 85 | +
|
| 86 | +5. **Review the new version in the npm registry** |
| 87 | +
|
| 88 | + After publishing the package, you can review the new version in the [npm registry](https://www.npmjs.com/package/@iqss/dataverse-client-javascript?activeTab=versions). |
| 89 | +
|
| 90 | + The new version should be available in the npm registry. |
| 91 | +
|
| 92 | +## Merge "release branch" into "main" |
| 93 | +
|
| 94 | +Create a pull request to merge the `release` branch into the `main` branch. |
| 95 | +Once important tests have passed (unit, functional, integration), merge the pull request (skipping code review is ok). |
| 96 | +
|
| 97 | +## Merge "main" into "develop" |
| 98 | +
|
| 99 | +After merging the release branch into `main`, ensure the develop branch is updated with the latest changes. |
| 100 | +
|
| 101 | +Create a pull request to merge the `main` branch into `develop` branch. |
0 commit comments