Octo-tag is a library that help you with versioning when adding a tag to remote/locally.
It will automatically generate a version, calculated based on the previous version, if the tag on git doesn't have history, it will make new ones.
You can install globally by running this command
npm install -g octo-tag
or you just want to install in specific project, you can do with
npm install octo-tag --dev
running this command
octo-tag
when you running this command, it will give you some question and confirmation to make sure the tag is correct.
The questions consist of :
-
Environment (Staging, Production or Beta), if you choose
staging
, octo-tag will addalpha.1
in you tag, so the final tag will bev0.0.1-alpha.1
and if you chooseproduction
will add tag like commonlyv0.0.1
.( and the last one is beta on progress) -
Semantic Version Type (major, minor, patch), if you choose major, it will make the first number in your version increase, say you has previous version i.e :
v1.0.0
when you choosemajor
it will increase tov2.0.0
, if you chooseminor
, it will increase secondary number tov1.1.0
, and if you choosepatch
it will increase last number tov1.0.1
. -
Commit Id is used if you want add tag to specific commit/history id in your git.
-
Confirmation to add tag
-
Confirmation to push tag, in this step you can choose, you want to push the tag to remote/origin or not.
if you want to add prefix i.e from v1.0.0
to octo-tag-1.0.0
, you can add argument --prefix=customtag-
octo-tag --prefix=customtag-
-
octo-tag will get latest version in remote, if the latest version is v1.0.0, and you choose environment
staging
and semantic versionmajor
. the versioning will generatev2.0.0-alpha.1
. or ifbeta
selected it will havev2.0.0-beta.1
. -
If the
v2.0.0-alpha.1
is exist, it will increase latest number, so the output willv2.0.0-alpha.2
change your version in package.json
i.e: 1.0.0 to 2.0.0
npm login
npm publish
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.