|
| 1 | +# Autogit |
| 2 | + |
1 | 3 | <p align="center"> |
2 | | - <img src="assets/logo.png" /> |
| 4 | + <img src="assets/logo.png" style="width: 200px; height: 200px;"/> |
3 | 5 | </p> |
4 | 6 |
|
5 | | -## 🎯 Goals |
| 7 | +**Communicating through git professionally** |
| 8 | + |
| 9 | +autogit is a CLI tool to validate submitted commits according to [git conventional commits standard](https://www.conventionalcommits.org/en/v1.0.0/). the tool allows to generate changelogs for releases in different formats. When you generate changelogs and see quick feedback of an end result, it promotes you to write commits better. |
| 10 | + |
| 11 | +as a result of a tool work, you communicate your developer work better to other developers and have more professional looking repository. |
| 12 | + |
| 13 | +# Features |
| 14 | + |
| 15 | +- hooks to git-hooks and works to validate your git commits to git conventional commits standard for any git tool. |
| 16 | + - has extra possible validating rules to configure, like having minimum 3 words in a subject of a commit. |
| 17 | + - `autogit hook activate --global`(flag to turn it on for all repos) |
| 18 | +- suggests next [semantic version](https://semver.org/) with `autogit semver` |
| 19 | + - has options to sugest next version as alpha, beta, prerelease version with build meta data. |
| 20 | +- generates changelogs with `autogit changelog` command |
| 21 | + - currently supports markdown and bbcode formats |
| 22 | + - has option `--validate` to run validation of commits (for CI usage) |
| 23 | +- easy create and push of a git tag with autoinserted changelog through `autogit semver --tag --push` |
| 24 | +- CI friendly, not requires any dependencies for its usage for everything (inbuilt git-go to access git information) |
| 25 | + |
| 26 | +# Example |
| 27 | + |
| 28 | +text version at ubuntu 22.04: |
| 29 | +- `apt update && apt install -y curl` (install curl if not installed) |
| 30 | +- install latest |
| 31 | + |
| 32 | +# Installation |
| 33 | + |
| 34 | +## Linux |
| 35 | + |
| 36 | +### Install latest |
| 37 | + |
| 38 | +- install curl if not present |
| 39 | +- install with `rm /usr/local/bin/autogit ; curl -L $(curl -Ls -o /dev/null -w %{url_effective} https://github.com/darklab8/darklab_autogit/releases/latest | sed "s/releases\/tag/releases\/download/")/autogit-linux-amd64 -o /usr/local/bin/autogit && chmod 777 /usr/local/bin/autogit` |
6 | 40 |
|
7 | | -- CI friendly tool for automatic following of [Git Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) rules (standard for more descriptive commits) |
8 | | -- The tool generates automatically changelogs of new features and bug fixes for your product releases |
9 | | -- and also calculates next [semantic version](https://semver.org/) your next product release should be having |
| 41 | +- check installation with `autogit version` command. Expect to see `OK autogit version: v{version}` |
10 | 42 |
|
11 | | -Essentially tool... To decrease toll on release documentation writing, and to start writing more descriptive commits \ |
12 | | -It will help to make your repository looking like more professional in terms of commits, tags, versions, releases and changelogs. \ |
13 | | -With ability to see quickly how your changelog looks like, it will motivate you to write more meaningful commits |
| 43 | +### install specific version |
14 | 44 |
|
15 | | -## 🌟 Features |
| 45 | +- install with `rm /usr/local/bin/autogit ; curl -L https://github.com/darklab8/darklab_autogit/releases/download/v2.1.0/autogit-linux-amd64 -o /usr/local/bin/autogit && chmod 777 /usr/local/bin/autogit` |
| 46 | +- See other installations at {INSERT LINK TO OTHER INSTALLATIONS} |
16 | 47 |
|
17 | | -- [git conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) validations (and optional other ones) on pre-commit hook |
18 | | -- validation of your commit history on `autogit changelog --validate` request |
19 | | -- automatic next [semantic versioning](https://semver.org/spec/v2.0.0.html) calculation for your product release. `autogit semver` |
20 | | - - creating and pushing tag on `autogit semver --tag --push`. Changelog is automatically auto inserted into this tag. |
21 | | -- auto generating [changelogs](https://github.com/darklab8/darklab_autogit/releases/tag/v0.3.0-rc.2) new features and bug fixes for your next product release |
22 | | -- CI friendly binary file for any OS and arhictecture. Development with CI in mind. [CI examples](https://github.com/darklab8/darklab_autogit/tree/master/.github/workflows). Compiled for: |
23 | | - - linux-amd64 |
24 | | - - linux-arm64 |
25 | | - - linux-386 |
26 | | - - linux-arm |
27 | | - - windows-amd64 |
28 | | - - windows-386.exe |
29 | | - - windows-arm64.exe |
30 | | - - windows-arm.exe |
31 | | - - macos-amd64 |
32 | | - - macos-arm64 |
33 | | -- Contains inbuilt git. Not requiring git to be installed for its functionality |
| 48 | +## Contacts |
34 | 49 |
|
35 | | -## 🤙 Support: |
36 | | - |
37 | | -##### First tier support - we will prioritize solving any issues. Unit tests run on every commit. |
38 | | - |
39 | | -- for linux and CI usage |
40 | | - |
41 | | -##### Second tier support - periodically checking it works in VM with Windows 10 |
42 | | - |
43 | | -- for windows |
44 | | - |
45 | | -##### Third tier support - only compiled, and accepting bug fixes implemented by contributors |
46 | | - |
47 | | -- for macos |
48 | | - |
49 | | -## 🚀 Short opinionated installation |
50 | | - |
51 | | -assuming you have Linux: |
52 | | - |
53 | | -1) `curl -o /usr/local/bin/autogit https://github.com/darklab8/darklab_autogit/releases/download/v1.2.0/autogit-linux-amd64 && chmod 777 /usr/local/bin/autogit` |
54 | | -2) `autogit semver` to verify installation and get next expected semantic version |
55 | | -3) (Optional) config init |
56 | | - |
57 | | - * `autogit init` to create `autogit.yml` config locally in repo. |
58 | | - * `autogit init --global` to make user global settings file fallback |
59 | | - * if u will do nothing, program will just fallback to using config from memory |
60 | | -4) `autogit hook activate` to turn validation commit hooks on |
61 | | - |
62 | | - * `autogit hook activate --global` will turn it on globally for all repos |
63 | | - * `autogit hook deactivate` (also with possible flag `--global`) can serve to deactivate this functionality |
64 | | - |
65 | | -## ✈️ Detailed installation |
66 | | - |
67 | | -1. [download latest stable release](https://github.com/darklab8/darklab_autogit/releases) and put to env PATH searchable range |
68 | | - |
69 | | -- Linux: |
70 | | - |
71 | | - - Check your PATH bin serachable locations with `echo "$PATH"` and put into any of them or add new location, change settings to allow it being executable with `chmod` |
72 | | - - Recomendation to put into `/usr/local/bin` |
73 | | - - Linux ubuntu one liner: `curl -o /usr/local/bin/autogit https://github.com/darklab8/darklab_autogit/releases/download/v1.1.0/autogit-linux-amd64 && chmod 777 /usr/local/bin/autogit` |
74 | | -- Windows: |
75 | | - |
76 | | - - Check your PATH bin locations with `echo %PATH%` and put binary file any of them or add to new one, be sure to rename from like `autogit-windows-amd64.exe` to `autogit.exe` |
77 | | - - If u use `Git Bash`, recommendation to put into `~/bin` for usage in Git Bash only, or into `C:\Program Files\Git\cmd` for working in any terminal |
78 | | - - U can add to any other PATH bin searchable locations or add a new one |
79 | | -- MacOS |
80 | | - |
81 | | - - (To be written where to put) |
82 | | - |
83 | | -2. (Optional) init autogit.yml with `autogit init` command in the root of repository. change REPOSITORY_OWNER and REPOSITORY_NAME to yours |
84 | | - 1. Or init global one, or don't init at all (see 3d step of short opinionated instructioon) |
85 | | -3. run `autogit hook activate` to create `.git-hook` folder and enabling it in your git config for automated commit validation on pre-commit hook |
86 | | - 1. Or activate globally with flag `--global` |
87 | | - 2. `deactivate with `autogit hook deactivate`, using `--global` flag if necessary as well. |
88 | | - |
89 | | -P.S. Current repository runs on configured autogit as well |
90 | | - |
91 | | -## 🤾♂️ Usages |
92 | | - |
93 | | -### scenario #1 - validator / Git commit validation / Changelog validation |
94 | | - |
95 | | -You try to write git commit -m "feat: add rendering in format format" |
96 | | -your githook is activated and tries to parse your commit name accroding to git conventional commits standard. If unable, it will give you error and prevent commit |
97 | | - |
98 | | -```mermaid |
99 | | -flowchart TD |
100 | | - GitCommit[attempt to fixate commit like\ngit commit -m 'feat: add md rendering'\nwith 'autogit hook activate' enabled] |
101 | | - RequestValidatingChangelog[Request changelog with --validate flag] --> TryParsingCommitMessage |
102 | | - GitCommit --> TryParsingCommitMessage[Try parsing commit message\nto git conventional commit\ntype \ scope \ subject \ body \ footers] |
103 | | - TryParsingCommitMessage --> ReportFail[Reporting errors if unable] |
104 | | - TryParsingCommitMessage --> ContinuingValidation[Continue Validation] |
105 | | - ContinuingValidation --> CheckOptionalValidationRulesIfEnabled[Check options validation rules\nif they are enabled] |
106 | | - CheckOptionalValidationRulesIfEnabled --> CommitTypeInAllowedList[Commit type is\nin allowed list] |
107 | | - CommitTypeInAllowedList --> WhenAppliedRules |
108 | | - CheckOptionalValidationRulesIfEnabled --> CheckOtherEnabledRulesInSettings[Check other enabled\nrules in settings] |
109 | | - CheckOtherEnabledRulesInSettings --> WhenAppliedRules |
110 | | - CheckOptionalValidationRulesIfEnabled --> WhenAppliedRules[when applied rules] |
111 | | - WhenAppliedRules --> IfCommit[if it was commit,\nthen fixate if passed rules,\nor cancel fixation] |
112 | | - WhenAppliedRules --> IfChangelog[if it was changelog validation\nthen report no errors and exit code 0\nfor pipeline checks] |
113 | | -``` |
114 | | - |
115 | | -### scenario #2 - changelog / Your wish to see changelog of additions you made, what are new features, what are fixes. For user view |
116 | | - |
117 | | -You wish to have changelog auto generated. |
118 | | - |
119 | | -```mermaid |
120 | | -flowchart TD |
121 | | - RequestingChangelog[Requesting changelog] |
122 | | - RequestingChangelog --> ChangelogFromLatestCommitToPreviousTagVersion |
123 | | - ChangelogFromLatestCommitToPreviousTagVersion[Requesting changelog from previous\ntag to latest commit] |
124 | | - RequestingChangelog --> ChangelogFromChosenTagToPreviousTag |
125 | | - ChangelogFromChosenTagToPreviousTag[Requesting changelog from chosen tag\nversion to previous tag version] |
126 | | - ChangelogFromLatestCommitToPreviousTagVersion --> GenerateChangelog |
127 | | - GenerateChangelog[Start generating changelog] |
128 | | - ParseCommits[Parse commit in necessary tag range] |
129 | | - ChangelogFromChosenTagToPreviousTag --> GenerateChangelog |
130 | | - GenerateChangelog --> ParseCommits |
131 | | - ParseCommits --> SelectAllowedTypesForRender |
132 | | - SelectAllowedTypesForRender[Filter conventional commit `types` like `feat` allowed for render] |
133 | | - SelectAllowedTypesForRender --> SubgroupIntoConventionalCommitScopes |
134 | | - SubgroupIntoConventionalCommitScopes[Sub group commits according to conventional commit `scope`] |
135 | | - GenerateChangelog --> CalculateNextSemver |
136 | | - CalculateNextSemver[Calculate Next Semantic Version] |
137 | | - CalculateNextSemver --> SendChangelogToRender |
138 | | - SubgroupIntoConventionalCommitScopes --> SendChangelogToRender |
139 | | - SendChangelogToRender[Receive changelog for render] |
140 | | - SendChangelogToRender --> RenderChangelogMarkdown |
141 | | - SendChangelogToRender --> RenderChangelogRst |
142 | | - SendChangelogToRender --> RenderChangelogHtml |
143 | | - RenderChangelogMarkdown[Render in markdown\n--implemented--] |
144 | | - RenderChangelogRst[Render in rst\n--not implemented--] |
145 | | - RenderChangelogHtml[Render in html\n--not implemented--] |
146 | | -``` |
147 | | - |
148 | | -###### example of rendered changelog |
149 | | - |
150 | | -[Full example of rendered changelog](https://github.com/darklab8/darklab_autogit/releases/tag/v0.3.0-rc.2) |
151 | | - |
152 | | -### Scenario #3 - nextSemVer / You wish to know which next semantic version / semantic tag should be applied to your release. |
153 | | - |
154 | | -Program checks if u made no commits, or only refactoring and styling. |
155 | | - |
156 | | -- If u made no changes, then next version is same as previous one. |
157 | | -- If you made `fix`, then it increases PATCH version of semantic version. Your next version is `0.0.2` rendered |
158 | | -- if you made `feat` request, then next MINOR version is increased. Your next version is `0.1.0` |
159 | | -- if you made breaking changes, users should know `feat!` or `BREAKING CHANGE:`, then next version is `1.0.0` |
160 | | -- if u had no previous versions, it will calculate new one as `0.0.0` + calculated version changes |
161 | | - |
162 | | -more detailed algorithm, accounting also prerelease version calculations: |
163 | | - |
164 | | -```mermaid |
165 | | -flowchart TD |
166 | | - RequestNextSemanticVersioning[Request next semantic versioning] |
167 | | - RequestNextSemanticVersioning --> FindCommits[Find commits\nfrom HEAD^1 to previous stable semantic version like v0.3.0] |
168 | | - FindCommits --> CalculateVersionChange[Calculate main version change\nChoose only ONE path] |
169 | | - CalculateVersionChange --> MajorChange[if git conventional commits\nwith breaking changes\nlike feat! are present\nand it is not 0.*.* development mode\nor flag `--publish` is present,\nthen add MAJOR version\nand reset MINOR and PATCH to 0\nchange: +1.0.0] |
170 | | - CalculateVersionChange --> MinorChange[If commits with `feat` type are present\nincrease MINOR version\nand reset PATCH version\nto zero change: *.+1.0,] |
171 | | - CalculateVersionChange --> PatchChange[if only commits with `fix`\n are present\nthen change only PATCH\nchange: *.*.+1] |
172 | | - MajorChange --> CalculatedMainVersion |
173 | | - MinorChange --> CalculatedMainVersion |
174 | | - PatchChange --> CalculatedMainVersion |
175 | | - CalculatedMainVersion[Calculated main version] |
176 | | - CalculatedMainVersion --> CalculatePrereleaseVersion[Calculate next prerelease version] |
177 | | - CalculatePrereleaseVersion --> FindLatestPrerelease[Find latest alpha beta and rc versions\nwith scanning commits up to latest stable version\nExcept not counting latest commit\nChoose ONE, SEVERAL or ALL paths next:] |
178 | | - FindLatestPrerelease --> AlphaFlag[if alpha flag is present\nincrease alpha version\nand mark for rendering] |
179 | | - FindLatestPrerelease --> BetaFlag[if beta flag is present\nincrease beta version\nand mark for rendering] |
180 | | - FindLatestPrerelease --> RcFlag[if rc-release candidate-\nflag is present\nincrease rc version\nand mark for rendering] |
181 | | - AlphaFlag --> CombineIntoTotalPrereleaseVersion |
182 | | - BetaFlag --> CombineIntoTotalPrereleaseVersion |
183 | | - RcFlag --> CombineIntoTotalPrereleaseVersion |
184 | | - CombineIntoTotalPrereleaseVersion[Combine into latest prerelease version] |
185 | | - CalculatedMainVersion ----> AddBuildMetaData[Add build meta data\nas +$BuildMetaData\nto the end of version] |
186 | | - CombineIntoTotalPrereleaseVersion --> OutputFinalSemanticVersion |
187 | | - AddBuildMetaData --> OutputFinalSemanticVersion[Render Final Semantic Version] |
188 | | -``` |
189 | | - |
190 | | -### TLDR |
191 | | - |
192 | | -So in a nutshell, it takes away complexity of using git conventional commits and semantic versioning. You are auto guided and auto corrected how correctly to perform it xD |
193 | | -u only need correctly writing meaning/subject/description to your commits 🙂 but since u see what is rendered to users, you quickly learn how to write it better |
194 | | -Plus it was made in CI friendly way |
195 | | - |
196 | | -why semantic versioning is important, to read here https://semver.org/ |
197 | | -well, about git conventional commits is here: https://www.conventionalcommits.org/en/v1.0.0/ |
198 | | - |
199 | | -as an example, all my releases of darktool were made with similar automatation. |
200 | | -Changelogs and versions https://github.com/darklab8/darklab_freelancer_darktool/releases |
201 | | - |
202 | | -## ⚛️ Future development and resources for inspiration |
203 | | - |
204 | | -- https://www.quora.com/What-is-the-difference-between-alpha-beta-and-RC-software-version // Adding ability of beta versions |
205 | | -- https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional // Configurable stricter rules to validator |
206 | | -- https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines // Just more about git conventional commits |
207 | | -- https://www.npmjs.com/package/git-conventional-commits |
208 | | -- https://www.conventionalcommits.org/en/about/ tools |
209 | | -- https://github.com/c4urself/bump2version/blob/master/RELATED.md // research alternatives |
210 | | -- https://gist.github.com/qoomon/5dfcdf8eec66a051ecd85625518cfd13 |
211 | | - |
212 | | -Discussions about future development and features in [Pull Requests](https://github.com/darklab8/darklab_autogit/issues) |
213 | | - |
214 | | -## 📇 Dev Requirements |
215 | | - |
216 | | -- golang |
217 | | - - wget https://go.dev/dl/go1.20.3.linux-amd64.tar.gz |
218 | | - - sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.20.3.linux-amd64.tar.gz |
219 | | - - export PATH=$PATH:/usr/local/go/bin |
220 | | -- cobra generator https://github.com/spf13/cobra-cli/blob/main/README.md |
221 | | -- cobra guide https://github.com/spf13/cobra/blob/main/user_guide.md |
222 | | -- godoc |
223 | | -- add binary discovery for cobra-cli, godoc detection |
224 | | - - `export PATH="$PATH:/usr/local/go/bin:$HOME/go/bin"` |
225 | | -- install latest stable autogit 😄 |
226 | | - |
227 | | -## 🏛️ Code architecture |
228 | | - |
229 | | -```mermaid |
230 | | -flowchart TD |
231 | | - UI[Interface-CLI\nUser interface via Cobra CLI third party lib] |
232 | | - UI --> Actions[Actions\nreusable actions without\nattachements to UI details] |
233 | | - Actions --> SemanticGit[Semantic Git\nImplements main business logic of repository\nwith added logic of conventional commits\nAnd semantic versioning] |
234 | | - Actions --> Changelog[Changelog\nHow to generate one] |
235 | | - Actions --> Validator[Validator\nRules for optional validations] |
236 | | - Changelog --> SemanticGit |
237 | | - Validator --> SemanticGit |
238 | | - SemanticGit --> SemVer[SemVer\nimplements original Semantic Version\naccording to SemVer2.0.0 standard\nImplemented in current repo] |
239 | | - SemanticGit --> Git[Git\ngit wrapper to simple interface\nfor current repository logic\nimplemented in current repo] |
240 | | - Git --> GitGo[Git-Go\nEngine under the hood for\nGit repository operations\nImplemented by third party] |
241 | | -``` |
242 | | - |
243 | | -## 🤝 Contributions and contacts: |
244 | | - |
245 | | -- contact author [@dd84ai](https://github.com/dd84ai) at `dark.dreamflyer@gmail.com` |
246 | | -- open [Pull Requests with bug fix or feat requests](https://github.com/darklab8/darklab_autogit/issues) |
247 | | -- join [Darklab Discord server](https://discord.gg/aukHmTK82J) |
248 | | - |
249 | | -## ❓ FAQ |
250 | | - |
251 | | -- if u have strange bugs, consider as first actions |
252 | | - - updating to latest verion |
253 | | - - wiping previous present repository local and user global autogit.yml settings file :smile: |
| 50 | +- [@dd84ai](https://github.com/dd84ai) at `dark.dreamflyer@gmail.com` |
| 51 | +- open [Pull Requests with question](https://github.com/darklab8/darklab_autogit/issues) |
| 52 | +- [Darklab Discord server](https://discord.gg/aukHmTK82J) |
0 commit comments