[[ReleaseGuide-ReleaseGuide]]
= Apache Camel Kafka Connect release process
:page-aliases: release-guide.adoc

The process is _mutatis mutandis_ the same as for the main Apache Camel repository - see the
xref:manual::release-guide.adoc[Release guide] page of the Camel documentation.

Here, just a sketch of the repeating part, after you have performed the initial setup following the
xref:manual::release-guide.adoc[Camel Release guide]. In particular the section about setting up your maven environment as described in xref:manual::release-guide.adoc#ReleaseGuide-MavenSetup[Camel Release Maven Setup].

== Pre release tasks

* Close the GitHub release https://github.com/apache/camel-kafka-connector/milestones[milestone] and assign any remaining issues that aren't covered by the release to the next milestone

== Export local variables for convenience
If you are releasing version 4.8.0, these are typical variables values:
[source,shell]
----
$ export RELEASE_BRANCH=camel-kafka-connector-4.8.x
$ export RELEASE_TAG=amel-kafka-connector-4.8.0
$ export RELEASE_VERSION=4.8.0
$ export NEXT_VERSION=4.8.1-SNAPSHOT
$ export APACHE_USER=
$ export APACHE_PASS=
----

IMPORTANT: `RELEASE_BRANCH` must be different from the `RELEASE_TAG` you will choose later in the release process.

NOTE: A good branch name is in the form `camel-kafka-connector-4.8.x` if you are performing `4.8.0` release.

IMPORTANT: If you followed xref:manual::release-guide.adoc#ReleaseGuide-MavenSetup[Camel Release Maven Setup] you should have your gpg mave settings in a profile called `gpg` tha is used in some commands as `-Pgpg`. If that is not the case, change the commands accordingly to your setup.

== Create a release branch

Be sure you switch to a branch to perform the release, do not release from `main` branch unless you have a specific reason and you know what you are doing:

[source,shell]
----
$ git checkout -b $RELEASE_BRANCH
----

== (Optional) release dry run

You can do a dry run to be sure all is ok:

[source,shell]
----
$ ./mvnw release:prepare -DdryRun -Prelease -Pgpg -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion=$NEXT_VERSION
----

if you performed a dray run please clean up the release before continuing:

[source,shell]
----
$ ./mvnw release:clean
----

== `release:prepare` and `release:perform`

Prepare the release:

[source,shell]
----
./mvnw -Prelease -Pgpg -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion=$NEXT_VERSION -Dtag=$RELEASE_TAG -Dusername=$APACHE_USER -Dpassword=$APACHE_PASS release:prepare
----

NOTE: `$RELEASE_TAG` is usual in the form of `camel-kafka-connector-$RELEASE_VERSION`

Add and commit all the updated json with a commit comment on the line of `"[after release perform chore]: regen catalog descriptors with new version"` then update the tag `$RELEASE_TAG` to point to the just created commit and push it upstream (you may need to delate the original tag `$RELEASE_TAG` created during the `release:prepare` step above):

[source,shell]
----
$ git checkout $RELEASE_TAG
$ git add *.json
$ git commit -m"[after release perform chore]: regen catalog descriptors with new version"
$ git tag -f $RELEASE_TAG
$ git push -f upstream $RELEASE_TAG
$ git checkout $RELEASE_BRANCH
----

Upload your artifacts on apache nexus maven server:

[source,shell]
----
$ ./mvnw -Prelease -Pgpg -Dusername=$APACHE_USER -Dpassword=$APACHE_PASS release:perform
----

If you feel brave, the above two steps could be performed together:
[source,shell]
----
$ ./mvnw -Pgpg clean release:clean release:prepare -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion=$NEXT_VERSION -B release:perform
----

TIP: All the steps above have been automated in a script that you can run with `./release-utils/release.sh` . You should input the requested information that are used to fill in the exported variable describe in xref:_export_local_variables_for_convenience section.

In case an issue occurs during `release:perform`, it could be worth trying to resume from the failing artifact.
For instance, would an issue occurs while performing the release of `camel-splunk-kafka-connector`, a resume attempt could be triggered as below:

[source,shell]
----
$ cd target/checkout
$ ./mvnw -Prelease -Pgpg -Dusername=$APACHE_USER -Dpassword=$APACHE_PASS deploy -rf :camel-splunk-kafka-connector
----

== Close Apache Nexus staging repository

 * Go to https://repository.apache.org
 * staging repository
 * select the open repository (the name usually contains a number)
 * close it

There will be some checks done by nexus, wiat tho see that they complete successfully.

== Upload the staging sources to Apache dev server

Upload the files:

 * `distribution/target/camel-kafka-connector-$RELEASE_VERSION-src.zip`
 * `distribution/target/camel-kafka-connector-$RELEASE_VERSION-src.zip.asc`
 * `distribution/target/camel-kafka-connector-$RELEASE_VERSION-src.zip.sha512`

to apache dist svn:

[source,shell]
----
$ cd release-utils/scripts
$ ./upload-source.sh $RELEASE_VERSION $RELEASE_VERSION
----

== Open the vote

Send an email to dev@camel.apache.org with object: `[VOTE] Release Camel-Kafka-connector $RELEASE_VERSION` you can select 48 or 72 hours for the vote. The message can be something like:

[source,text]
----
Hello all,

This is a vote to release Apache Camel-kafka-connector X

Staging repository:
https://repository.apache.org/content/repositories/orgapachecamel-Y

Tag:
https://gitbox.apache.org/repos/asf?p=camel-kafka-connector.git;a=tag;h=refs/tags/camel-kafka-connector-X

<some release comments here>

Please test this release candidate and cast your vote.
[ ] +1 Release the binary as  Apache Camel-kafka-connector X
[ ] -1 Veto the release (provide specific comments)

The vote is open for at least <48 | 72> hours.

Thanks.
----

where `X` is the release you are performing and `Y` is the staging repository number created during release.

== Merge the release branch back in main

This may require a rebase of `main` branch on the release branch if some commits have been added to `main` after you created the release branch (in that case you can perform a `push -f` on `main`)

== Close the vote
Once the  vote time has passed send another email with object: `[RESULT][VOTE] Release Camel-Kafka-connector $RELEASE_VERSION` with the count of binding and not binding votes. The message can be something like:

[source,text]
----
Hi all,

This vote passes with the following result

Y +1 binding votes (<names of binding votes>)
Z +1 non-binding (<names of non binding votes>)

Thanks to everybody.

I'll publish the artifacts in a bit.

Regards.
----

== Release the artifacts

* Go to https://repository.apache.org
* staging repository
* select the closed repository
* release it

== Upload the sources to Apache dist server

Upload the files:

 * `distribution/target/camel-kafka-connector-$RELEASE_VERSION-src.zip`
 * `distribution/target/camel-kafka-connector-$RELEASE_VERSION-src.zip.asc`
 * `distribution/target/camel-kafka-connector-$RELEASE_VERSION-src.zip.sha512`

to apache dist svn:

[source,shell]
----
$ ./release-utils/scripts/promote-release.sh $RELEASE_VERSION
----

== Create a release note

Create a release note in https://github.com/apache/camel-website/tree/master/content/releases/ckc by coping and changing one of the already present.

== Update Antora playbook

Add the created release branch to https://github.com/apache/camel-website/blob/main/antora-playbook-snippets/antora-playbook.yml under:

[source,yaml]
----
    - url: https://github.com/apache/camel-kafka-connector.git
    branches:
      - main
      ...
----

== Update latest released version

Update last released version:

[source,xml]
----
<configuration>
    <lastReleasedVersion>$RELEASE_VERSION</lastReleasedVersion>
</configuration>
----

in `connectors/pom.xml` and regen.
