batoulapps / adhan-js

High precision Islamic prayer time library for JavaScript
MIT License
376 stars 86 forks source link

add semantic-release and make the repo commitizen-friendly #44

Closed khawarizmus closed 3 years ago

khawarizmus commented 3 years ago

Before merging: create a tag with the name v4.0.3 at the same level where the current 4.0.3 tag exists

Note: Once semantic-release is configured, any user with the permission to push commits to master or the branches listed on the .releaserc will be able to publish a release. It is recommended to protect those branches, for example with GitHub protected branches.

After merging: disable the dry-run for semantic-release in the Github action

close #37

khawarizmus commented 3 years ago

@z3bi @sgtsquiggs there is a need to create a new tag with that name v4.0.3 before merging this so that semantic-release will start counting commits from the last release. otherwise semantic release will release a new version starting from v1.0.0

image

z3bi commented 3 years ago

Would the idea be to then commit to a develop branch and once it's time to release do a single PR from develop to master?

khawarizmus commented 3 years ago

@z3bi yes exactly.

to quote the original git-flow article which can be found here

The master branch at origin should be familiar to every Git user. Parallel to the master branch, another branch exists called develop.

We consider origin/master to be the main branch where the source code of HEAD always reflects a production-ready state.

We consider origin/develop to be the main branch where the source code of HEAD always reflects a state with the latest delivered development changes for the next release. Some would call this the “integration branch”. This is where any automatic nightly builds are built from.

using the git-flow branching model we obtain a more clear/organized way of collaboration

sgtsquiggs commented 3 years ago

@gimyboya is it that we needed to add 4.0.3 specifically, or do we just need a tag immediately before merging this?

khawarizmus commented 3 years ago

@sgtsquiggs sorry I didn't explain the logic behind the creation of a new tag.

For semantic-release to be able to start counting commits starting from the last release of this repo (which at the time of this writing is 4.0.3 ) we need to create a tag that semantic-release recognizes for it to start analyzing commits from that tag and knowing that the last version was v4.0.3 and the next one will be from there onwards otherwise, it will release the next version starting from v1.0.0.

currently, this repo already has a version tag with the following format 4.0.3 at the last release commit, however, semantic release ignores that tag because it's looking for a tag with the following format v${version}.

it is possible to provide a different tag format for semantic-release with the -t or --tag-format flags when using the CLI. unfortunately, since we are using semantic-release from cycjimmy/semantic-release-action GitHub action, I couldn't find a way to provide that option to semantic-release as it's not exposed in the GitHub action configuration.

Thus I suggested creating a v4.0.3 tag first which should be at the same level where the current 4.0.3 tag exists then merge this PR. the moment this PR is merged GitHub action will be triggered and semantic-release will start working.

The expected result is that it won't release any new version as all the types of commits I have committed were either chore, ci, or build and none of them was feature or fix type.

I have also put it on dry-run mode just for safety and forgot to mention that once everything is merged and working properly you will need to disable the dry-run mode. (I will comment on that after this)

khawarizmus commented 3 years ago

Looking forward to your feedback @z3bi @sgtsquiggs Let me know if you guys need anything on my side

z3bi commented 3 years ago

Lets go ahead with this PR. @gimyboya there are some merge conflicts that came up. If you can go ahead and resolve those I will create the tag we need.

z3bi commented 3 years ago

Tag has been created so we are good to go there.

khawarizmus commented 3 years ago

@z3bi Conflict is waved. Thank you for taking the time to review this PR

khawarizmus commented 3 years ago

@z3bi Thank you for mergin!

Lastly don't forget to turn off the dry-run once you confirm that semantic-release is working as intended.

z3bi commented 3 years ago

@gimyboya yup we are just testing everything out right now. Thanks for this awesome PR!

github-actions[bot] commented 3 years ago

:tada: This PR is included in version 4.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: