Skip to content

Commit

Permalink
Update README to include usage guidelines (#5)
Browse files Browse the repository at this point in the history
* Update GitHub Action Version

* Update README to include usage guidelines
  • Loading branch information
DragosDumitrache authored Jan 17, 2024
1 parent 2deb6af commit 9117ccb
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-and-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
if: github.event_name != 'pull_request'
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Run tests
run: |
sudo apt-get upgrade && apt-get update
Expand Down
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
# Versioner
# Versioner

This is a language agnostic git versioning tool using tags.

![build-status](https://travis-ci.com/DragosDumitrache/versioner.svg?branch=master)
## Why this repo
There are plenty of tools available that can generate a version based on Git tags, or viceversa.
I decided to roll my own to offer a very simple approach at versioning, without any faff or unnecessary requirements.

Most of them follow the SemVer practices
There are plenty of tools available that can generate a version based on Git tags.
However, they are typically:

- driven by commit messages, not configuration
- dependent on programming languages

How to use the docker container:
```shell script
docker run -v $(pwd):/repo --rm dragosd2000/versioner
```
I didn't want to have to introduce a programming language into my pipeline, especially when it was a language that had
absolutely nothing to do with my pipeline, e.g. using an action implemented in JS in a Python project.
I also didn't feel like commit messages were the way to go, typos happen, and then someone needs to go and update it
manually.

The aim has been to have a very simple approach at versioning without introducing new dependencies, and for it to be
configuration driven.

## How to use it

For a specific version, let's say 1.0.2:
```shell script
docker run -v (pwd):/repo --rm dragosd2000/versioner:1.0.16
Inside your GHA pipeline, simply add the following step:

```yaml
- uses: DragosDumitrache/[email protected]
```
Inside your `Jenkinsfiles`, you should be able to define a container pointing to it to use inside your pipeline, or
just invoke the command above inside a docker container.
Incrementing the `major` or `minor` versions is done simply through a bump in your project's
corresponding `version.json` file. When this happens, the `patch` number is reset to 0. In all other cases, the `patch`
version is incrementally calculated from the number of commits added since the previous patch. For consecutive patches,
this approach works best with the `Squash and Merge` strategy.

3 changes: 0 additions & 3 deletions run_tests.sh

This file was deleted.

2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"default_branch": "master",
"major": "2",
"minor": "2"
"minor": "3"
}
2 changes: 1 addition & 1 deletion versioner/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ runs:
- uses: actions/checkout@v4
with:
repository: DragosDumitrache/versioner
ref: master
ref: 2.2.5
path: tools
- name: Generate and tag a new version
id: semver
Expand Down

0 comments on commit 9117ccb

Please sign in to comment.