Pre-requiste
To create a Git tag for any repository, maintainer-level access is required.
If you do not have the necessary permissions, a CMFSUPPORT ticket must be raised to obtain approval from the respective component owner.
Additionally, the repository must be configured to support git-flow.
If it is not already set up, a separate CMFSUPPORT ticket should be raised to request git-flow configuration for that specific repository.
Reference ticket:
CMFSUPPORT-2862
-
Getting issue details...
STATUS
Getting Started with git flow and auto-changelog Installation and Usage Overview
Git-Flow:
git-flow is a set of Git extensions that provide high-level repository operations based on Vincent Driessen’s branching model. It is particularly useful for maintaining older releases and managing structured development workflows.
Installation:
sudo apt-get install git-flow
Auto-Changelog:
auto-changelog is a command-line tool that generates changelogs automatically from Git tags and commit history.
Installation: (if npm package is not present by default, need to install)
npm install -g auto-changelog
Steps to Tag a Repository:
Once the component development process is complete, the component release process can begin. Follow the steps below to tag the repository appropriately:
# check which branch is HEAD
git branch -a
# if HEAD is set to origin/develop (remotes/origin/HEAD -> origin/develop) run
git fetch origin main:main
# initialize repo and git flow (once per clone)
git flow init -d
# create your release from develop
git flow release start <release number> <optional develop SHA1>
git flow release start 1.0.0
git add/commit # bug fixes, release stabilisation (only if applicable)
# create changelog and commit
auto-changelog -v <release version>
auto-changelog -v 1.0.0
git add CHANGELOG.md
git commit CHANGELOG.md
# publish the release branch
git flow release publish <release version>
git flow release publish 1.0.0
# at this stage please create Pull request for both develop and main branches from UI
# note the update on develop will only be CHANGELOG.md, main will be changelog and other changes
# do NOT merge from UI !!
# finish the release: this push changes to main & develop, creates a TAG, deletes the release branch
git flow release finish <release version>
git flow release finish 1.0.0
# push the changes and TAGS to origin
git push origin main
git push origin develop
git push origin --tags
For Example:
Repository for rdk-speedtest-cli - https://github.com/rdkcentral/rdk-speedtest-cli/
Note: Although the example shown here uses a forked version of the rdk-speedtest-cli repository, all actual development and tagging steps must be performed using the original rdkcentral repository. Here forked repository is used for demonstration only, not for official tagging or release activities.
Git Clone:
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~$ git clone https://github.com/ksaipr036/rdk-speedtest-cli.git
Cloning into 'rdk-speedtest-cli'...
remote: Enumerating objects: 22, done.
remote: Counting objects: 100% (22/22), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 22 (delta 6), reused 19 (delta 3), pack-reused 0 (from 0)
Receiving objects: 100% (22/22), 16.12 KiB | 8.06 MiB/s, done.
Resolving deltas: 100% (6/6), done.
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~$
Steps to be followed for tagging:(Reference logs)
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~$ git clone git@github.com:ksaipr036/rdk-speedtest-cli.git
Cloning into 'rdk-speedtest-cli'...
remote: Enumerating objects: 26, done.
remote: Counting objects: 100% (26/26), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 26 (delta 8), reused 21 (delta 3), pack-reused 0 (from 0)
Receiving objects: 100% (26/26), 16.73 KiB | 8.37 MiB/s, done.
Resolving deltas: 100% (8/8), done.
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~$ cd rdk-speedtest-cli/
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ git branch -a
* develop
remotes/origin/HEAD -> origin/develop
remotes/origin/develop
remotes/origin/main
remotes/origin/release/1.0.0
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ git fetch origin main:main
From github.com:ksaipr036/rdk-speedtest-cli
* [new branch] main -> main
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ git flow init -d
Using default branch names.
Which branch should be used for bringing forth production releases?
- develop
- main
Branch name for production releases: [main]
Which branch should be used for integration of the "next release"?
- develop
Branch name for "next release" development: [develop]
How to name your supporting branch prefixes?
Feature branches? [feature/]
Bugfix branches? [bugfix/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
Hooks and filters directory? [/home/chtsl00388/rdk-speedtest-cli/.git/hooks]
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ git flow release start 1.0.2
Switched to a new branch 'release/1.0.2'
Summary of actions:
- A new branch 'release/1.0.2' was created, based on 'develop'
- You are now on branch 'release/1.0.2'
Follow-up actions:
- Bump the version number now!
- Start committing last-minute fixes in preparing your release
- When done, run:
git flow release finish '1.0.2'
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ auto-changelog -v 1.0.2
auto-changelog: 1 kB written to CHANGELOG.md
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ git add CHANGELOG.md
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ git commit CHANGELOG.md
[release/1.0.2 ed8f23e] Creating tag for rdk-speedtest-cli for reference in forked repo
1 file changed, 8 insertions(+), 1 deletion(-)
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ git flow release publish 1.0.2
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 682 bytes | 682.00 KiB/s, done.
Total 3 (delta 1), reused 2 (delta 1), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
remote:
remote: Create a pull request for 'release/1.0.2' on GitHub by visiting:
remote: https://github.com/ksaipr036/rdk-speedtest-cli/pull/new/release/1.0.2
remote:
To github.com:ksaipr036/rdk-speedtest-cli.git
* [new branch] release/1.0.2 -> release/1.0.2
Branch 'release/1.0.2' set up to track remote branch 'release/1.0.2' from 'origin'.
Already on 'release/1.0.2'
Your branch is up to date with 'origin/release/1.0.2'.
Summary of actions:
- The remote branch 'release/1.0.2' was created or updated
- The local branch 'release/1.0.2' was configured to track the remote branch
- You are now on branch 'release/1.0.2'
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ #Created PR for both main and develop branches
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ git flow release finish 1.0.2
Switched to branch 'main'
Merge made by the 'ort' strategy.
Already on 'main'
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.
Merge made by the 'ort' strategy.
CHANGELOG.md | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
To github.com:ksaipr036/rdk-speedtest-cli.git
- [deleted] release/1.0.2
Deleted branch release/1.0.2 (was ed8f23e).
Summary of actions:
- Release branch 'release/1.0.2' has been merged into 'main'
- The release was tagged '1.0.2'
- Release tag '1.0.2' has been back-merged into 'develop'
- Release branch 'release/1.0.2' has been locally deleted; it has been remotely deleted from 'origin'
- You are now on branch 'develop'
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ git push origin main
Enumerating objects: 2, done.
Counting objects: 100% (2/2), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 423 bytes | 423.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
To github.com:ksaipr036/rdk-speedtest-cli.git
7a385c8..66e671d main -> main
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ git push origin develop
Enumerating objects: 1, done.
Counting objects: 100% (1/1), done.
Writing objects: 100% (1/1), 266 bytes | 266.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
To github.com:ksaipr036/rdk-speedtest-cli.git
801deaa..3ad416d develop -> develop
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ git push origin --tags
Enumerating objects: 1, done.
Counting objects: 100% (1/1), done.
Writing objects: 100% (1/1), 188 bytes | 188.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
To github.com:ksaipr036/rdk-speedtest-cli.git
* [new tag] 1.0.2 -> 1.0.2
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ #tag is created in this path
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$ #https://github.com/ksaipr036/rdk-speedtest-cli/tags
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
chtsl00388@chtsl00388-IdeaPad-5-14ITL05:~/rdk-speedtest-cli$
Repo: https://github.com/rdkcentral/rdk-speedtest-cli/
In the above repo, tag is created in the given path: https://github.com/rdkcentral/rdk-speedtest-cli/tags