Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom prefix, optional versioning based on multiple commit messages #102

Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
e2b5085
Added new optional PREFIX parameter to define a tag prefix
L-Sypniewski Nov 22, 2020
070e221
Implemented versioning based on multiple commit messages
L-Sypniewski Feb 5, 2021
e66606b
Prefix parameter versioning based on multiple messages (#1)
L-Sypniewski Mar 24, 2021
5a98e7f
Updated README.md
Jul 30, 2021
3067bbc
Applied suggestions from PR
L-Sypniewski Aug 3, 2021
d0bf515
Updated description of WITH_V variable in README
L-Sypniewski Aug 3, 2021
37e66bd
Added description for USE_LAST_COMMIT_ONLY variable in README
L-Sypniewski Aug 3, 2021
23b0f66
Fixed README description for HEAD_COMMIT variable
L-Sypniewski Aug 3, 2021
19edbd9
Restored logic broken after rebase
L-Sypniewski Aug 3, 2021
4f9b1be
Merge branch 'master' into prefix-parameter-versioning-based-on-multi…
L-Sypniewski Oct 14, 2021
dc90ed7
Add BRANCH_LATEST_COMMIT parameter, fix logic, refactor
L-Sypniewski Oct 26, 2021
64173b6
Print info about discarding calculated tag when custom tag is provided
L-Sypniewski Oct 27, 2021
94705e4
Fixed printed variable name
L-Sypniewski Oct 27, 2021
e2e8a8e
Remove ShellCheck warnings
L-Sypniewski Oct 28, 2021
824a7be
Fixed logic for calculating new tag
L-Sypniewski Oct 29, 2021
ab9c79f
If custom tag is provided no calculations are performed
L-Sypniewski Oct 29, 2021
1b3231f
Fix syntax
L-Sypniewski Apr 15, 2022
964d8ed
Restore syntax for bullet point list in readme
L-Sypniewski Apr 15, 2022
bc9eca9
Merge remote-tracking branch 'upstream/master' into prefix-parameter-…
L-Sypniewski Apr 15, 2022
20eda4a
Fix typos in readme
L-Sypniewski May 18, 2022
9554ac6
Merge remote-tracking branch 'upstream/master' into prefix-parameter-…
L-Sypniewski Sep 28, 2022
2dc729e
Add VSCode task to run tests locally with Act
L-Sypniewski Sep 28, 2022
71ad546
Merge remote-tracking branch 'upstream/master' into prefix-parameter-…
L-Sypniewski Sep 28, 2022
7034383
Merge remote-tracking branch 'upstream/master' into prefix-parameter-…
L-Sypniewski Oct 4, 2022
a015466
Add tests
L-Sypniewski Sep 28, 2022
e3223ab
custom_string_token
L-Sypniewski Oct 4, 2022
c03197d
Initial tag creation tests - don't pass
L-Sypniewski Oct 6, 2022
1ea1756
Fix initial tag logic
L-Sypniewski Oct 6, 2022
bad5519
bug fix
L-Sypniewski Oct 6, 2022
e848625
Remove redundant test, rename another
L-Sypniewski Oct 8, 2022
6dab57b
remove `is_first_commit_used' param from set_number_of_found_keywords
L-Sypniewski Oct 8, 2022
e6b3aaf
Clean code related to logging
L-Sypniewski Oct 8, 2022
8fbdd74
Handle the case of a repo with a single commit
L-Sypniewski Oct 8, 2022
2f4c3b2
All tests are ran in a single job
L-Sypniewski Oct 8, 2022
a58ad8e
Fix shellcheck warnings
L-Sypniewski Oct 8, 2022
b3b6ee9
Fix a bug with duplicated prefix
L-Sypniewski Nov 16, 2022
f4fab45
Fix create-tag-tag-with-prefix-is-bumped-if-tag-with-given-prefix-alr…
L-Sypniewski Nov 16, 2022
e8eeee1
Remove unnecesseray output assignment
L-Sypniewski Nov 16, 2022
bedffb2
Fix formatting
L-Sypniewski Nov 16, 2022
f248ae1
Fix typo path->patch
L-Sypniewski Dec 21, 2022
0beaa43
Bug fix: properly create a tag when initial version is provided with …
L-Sypniewski Jan 8, 2023
0d44d90
Throw an error when INITIAL_VERSION is in incorrect format
L-Sypniewski Jan 8, 2023
4967baa
Rename test cases
L-Sypniewski Jan 8, 2023
bac2fd1
Add custom-string-token-major-single-commit testcase
L-Sypniewski Jan 8, 2023
f9eeba8
Add custom-string-token-major-minor-patch-multiple-commits testcase
L-Sypniewski Jan 8, 2023
a2a7310
Add tests for WITH_V parameter
L-Sypniewski Jan 8, 2023
8bd3fd4
Rename test to be more descriptive
L-Sypniewski Jan 8, 2023
4b1ba1e
Remove verbose: true flags from tests
L-Sypniewski Jan 8, 2023
c660f7c
Add custom-tag-overrides-all-calculated-tags test
L-Sypniewski Jan 8, 2023
d2f1ce3
Update readme with information about correct format of INITIAL_VERSIO…
L-Sypniewski Jan 8, 2023
66e31fa
Add merge-branch-no-new-tags-on-master-since-branching-off-merge-comm…
L-Sypniewski Jan 10, 2023
1a092e8
Add merge-branch-new-tag-on-master-since-branching-off-merge-commit test
L-Sypniewski Jan 10, 2023
e9be947
Add merge-branch-no-new-tags-on-master-since-branching-off-fast-forwa…
L-Sypniewski Jan 10, 2023
8048bb9
Add merge-branch-new-tag-on-master-since-branching-off-fast-forward test
L-Sypniewski Jan 10, 2023
ad6f189
Remove git logs from bash scripts
L-Sypniewski Jan 10, 2023
29b81f0
Pipeline debug
L-Sypniewski Jan 10, 2023
eabf0cb
Remove quotes from assert script param to test if pipeline succeeds
L-Sypniewski Jan 10, 2023
7995bc2
Unify style in 'if' condition
L-Sypniewski Jan 10, 2023
a734b87
Add quotes
L-Sypniewski Jan 10, 2023
27a5053
Get rid of deprecated set-output and use $GITHUB_OUTPUT
L-Sypniewski Jan 11, 2023
ca8e54d
Change docker base image to fix 'detected dubious ownership in reposi…
L-Sypniewski Jan 11, 2023
19ea1fe
Restore commented out code
L-Sypniewski Jan 11, 2023
62cbc92
Disable schellcheck 2129 as it would break the logic
L-Sypniewski Jan 11, 2023
22353ab
Remove dokcerfile warnings
L-Sypniewski Jan 11, 2023
fd2b0ea
Merge remote-tracking branch 'upstream/master' into prefix-parameter-…
L-Sypniewski Jan 11, 2023
8cdc515
Use setOutput function
L-Sypniewski Jan 11, 2023
7313ae6
Removed redundant line
L-Sypniewski Jan 11, 2023
a3563cb
Remove commented out parameter from test
L-Sypniewski Jan 11, 2023
9c26878
Revert change from 7313ae6 as it is needed to output 'part' in some c…
L-Sypniewski Jan 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
PREFIX: prefix
```

_NOTE: set the fetch-depth for `actions/checkout@v2` to be sure you retrieve all commits to look for the semver commit message._
Expand All @@ -38,23 +39,27 @@ _NOTE: set the fetch-depth for `actions/checkout@v2` to be sure you retrieve all

**Environment Variables**

- **GITHUB_TOKEN** **_(required)_** - Required for permission to tag the repo.
- **DEFAULT_BUMP** _(optional)_ - Which type of bump to use when none explicitly provided (default: `minor`).
- **WITH_V** _(optional)_ - Tag version with `v` character.
- **RELEASE_BRANCHES** _(optional)_ - Comma separated list of branches (bash reg exp accepted) that will generate the release tags. Other branches and pull-requests generate versions postfixed with the commit hash and do not generate any tag. Examples: `master` or `.*` or `release.*,hotfix.*,master` ...
- **CUSTOM_TAG** _(optional)_ - Set a custom tag, useful when generating tag based on f.ex FROM image in a docker image. **Setting this tag will invalidate any other settings set!**
- **SOURCE** _(optional)_ - Operate on a relative path under $GITHUB_WORKSPACE.
- **DRY_RUN** _(optional)_ - Determine the next version without tagging the branch. The workflow can use the outputs `new_tag` and `tag` in subsequent steps. Possible values are `true` and `false` (default).
- **INITIAL_VERSION** _(optional)_ - Set initial version before bump. Default `0.0.0`.
- **TAG_CONTEXT** _(optional)_ - Set the context of the previous tag. Possible values are `repo` (default) or `branch`.
- **PRERELEASE_SUFFIX** _(optional)_ - Suffix for your prerelease versions, `beta` by default. Note this will only be used if a prerelease branch.
- **VERBOSE** _(optional)_ - Print git logs. For some projects these logs may be very large. Possible values are `true` (default) and `false`.
- **GITHUB_TOKEN** ***(required)*** - Required for permission to tag the repo.
- **DEFAULT_BUMP** *(optional)* - Which type of bump to use when none explicitly provided (default: `minor`).
- **WITH_V** **(deprecated)** *(optional)* - Tag version with `v` character. Deprecated variable - use `PREFIX` instead.
- **PREFIX** *(optional)* - Adds a prefix before version number.
- **RELEASE_BRANCHES** *(optional)* - Comma separated list of branches (bash reg exp accepted) that will generate the release tags. Other branches and pull-requests generate versions postfixed with the commit hash and do not generate any tag. Examples: `master` or `.*` or `release.*,hotfix.*,master` ...
- **CUSTOM_TAG** *(optional)* - Set a custom tag, useful when generating tag based on f.ex FROM image in a docker image. **Setting this tag will invalidate any other settings set!**
- **SOURCE** *(optional)* - Operate on a relative path under $GITHUB_WORKSPACE.
- **DRY_RUN** *(optional)* - Determine the next version without tagging the branch. The workflow can use the outputs `new_tag` and `tag` in subsequent steps. Possible values are ```true``` and ```false``` (default).
- **INITIAL_VERSION** *(optional)* - Set initial version before bump. Default `0.0.0`.
- **TAG_CONTEXT** *(optional)* - Set the context of the previous tag. Possible values are `repo` (default) or `branch`.
- **PRERELEASE_SUFFIX** *(optional)* - Suffix for your prerelease versions, `beta` by default. Note this will only be used if a prerelease branch.
- **VERBOSE** *(optional)* - Print git logs. For some projects these logs may be very large. Possible values are ```true``` (default) and ```false```.
- **BRANCH_LATEST_COMMIT** *(optional)* - Commit messages for commits of a given branch will be taken into account while calculating a new tag. Specifying bramch is useful when using this action for pull requests - one can set environment variable as follows: `BRANCH_LATEST_COMMIT: ${{ github.event.pull_request.head.sha }}` to calculate a new version basing on commits from a given PR. If not specified the current commit is used.
- **USE_LAST_COMMIT_ONLY** *(optional)* - True by default. If true only last commit is taken into account while bumping the version, otherwise all commits from the commit with the latest tag contribute to new tag calculation

#### Outputs

- **new_tag** - The value of the newly created tag.
- **tag** - The value of the latest tag after running this action.
- **part** - The part of version which was bumped.
- **new_tag** - The value of the newly created tag, e.g. my-prefix-1.2.3
- **new_tag_without_prefix** - The value of the newly created tag without specified prefix, e.g 1.2.3
- **tag** - The value of the latest tag before bumping it by running this action, e.g. my-prefix-1.2.2
- **part** - The part of version which was bumped, e.g. minor

> **_Note:_** This action creates a [lightweight tag](https://developer.github.com/v3/git/refs/#create-a-reference).

Expand Down
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ runs:
outputs:
new_tag:
description: 'Generated tag'
new_tag_without_prefix:
description: 'Generated tag without specified prefix'
tag:
description: 'The latest tag after running this action'
description: 'The latest tag before running this action'
L-Sypniewski marked this conversation as resolved.
Show resolved Hide resolved
part:
description: 'The part of version which was bumped'
branding:
Expand Down
Loading