## Release process

We are using timed releases with a new release every 6 months (2nd April/2nd
October).

To document the progress it is easiest to copy everything below into an issue.

If the automatic windows binary upload does not work, or you need to do it manually for other reasons, the
following snippet uploads all zip and msi files from the current folder:

```sh
#!/bin/sh

set -e

TOKEN= # adapt me
PROJECT_ID=24006041
PACKAGE_NAME=windows
PACKAGE_VERSION= # adapt me

for file in `ls *zip *msi`
do
  echo "Uploading $file"
  curl --header "PRIVATE-TOKEN: ${TOKEN}" --upload-file $file                \
       https://gitlab.com/api/v4/projects/${PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${PACKAGE_VERSION}/$file
done
```

<!-- start of issue -->

### When the previous release branch is created:

- [ ] Raise the library version (`MAJOR_VERSION`/`MINOR_VERSION`/`PATCH_VERSION`
in CMakeLists.txt) on `main`
- [ ] Tag the commit where the library version is raised as `$major.$minor.$patch-dev`

### At the beginning of the 6 month release cycle:

- [ ] Appoint a release manager who is responsible for the release process
      and create the release issue with the contents of this document between
      the `start of issue`/`end of issue` comments
- [ ] Create a milestone with due date
- [ ] Fill the milestone with issues

### 6 weeks before the release date:

- [ ] Create an issue to update RELEASE_NOTES.md and assign it to someone else
- [ ] Announce (slack: `kernel`) that there are two weeks left before the first release candidate
- [ ] \(TSD maintainer\) Update TSD/distribution.properties to see if it works
      with cppTango
- [ ] \(TSD maintainer\) Create issues for all dependent subprojects using [tools/ping-maintainers.py](https://gitlab.com/tango-controls/TangoSourceDistribution/-/tree/main/tools?ref_type=heads)

### 4 weeks before the release date:

- [ ] Determine if we have broken API/ABI compatibility for this release and
      make sure that the SO_VERSION is correct in the base CMakeLists.txt.
- [ ] Create a release branch named `release/$major.$minor.$patch` off `main`. From
      now on all merge requests for this release have to be done against this branch.
- [ ] Change the target branch of all MRs which should be part of this release to the new
      release branch
- [ ] Disable the `pages` job on the `main` branch

#### RC phase:

- [ ] Manually trigger the rest of the Windows CI jobs to verify that they work
- [ ] Tag the repo (`$major.$minor.$patch-rc$X`), this automatically creates a
      release and uploads the windows packages
- [ ] \(TSD maintainer\) Update TSD to use the new tag, merge it and tag as well
- [ ] Advertise the new release candidate on the `tango-info` mailing list and slack (channel: `general`)

During the RC phase it is advisable to only merge non-intrusive MRs to avoid
the possibility of last-minute regressions.

Creating a new release candidate should be redone every week when more MRs have been merged.

### At the release date:

All steps from the release candidate phase above:

- [ ] Manually trigger the rest of the Windows CI jobs to verify that they work
- [ ] Tag the release (`$major.$minor.$patch`)
- [ ] Update for TSD
- [ ] Advertise new release

and finally

- [ ] Delete release branch
- [ ] Allow the `pages` job to run on `main` again

<!-- end of issue -->

## Patch release steps

We make patch (0.0.X) releases of the last stable/LTS version available on a on-demand basis.

Criteria for acceptance of fixes:
- Regression
- Major bugs (crash, new functionality does not work, new memory leak, etc.)
- Compilation failure or other breakage with newer versions of dependencies (decided on a case-by-case basis)

<!-- start of issue -->

### Once it is decided to do a patch release

- [ ] Appoint a release manager
- [ ] Create a milestone with due date
- [ ] Fill the milestone with issues
- [ ] Create an issue to update RELEASE_NOTES.md and assign it to someone else
- [ ] Create a release branch named `release/$major.$minor.$patch` off the tag of the last stable/LTS version
- [ ] Raise the library version (`PATCH_VERSION` in CMakeLists.txt)

### One week before the release date

- [ ] Get all merge requests merged
- [ ] Tag the repo (`$major.$minor.$patch-rc$X`), this automatically creates a
      release and uploads the windows packages
- [ ] \(TSD maintainer\) Update TSD to use the new tag, merge it and tag as well
- [ ] Advertise the new release candidate on the `tango-info` mailing list and slack (channel: `general`)

### At the release date:

- [ ] Tag the release (`$major.$minor.$patch`)
- [ ] Update for TSD
- [ ] Advertise new release

and finally

- [ ] Delete release branch

<!-- end of issue -->
