github-tag-action/README.md

63 lines
3.9 KiB
Markdown
Raw Normal View History

2019-11-01 01:36:53 +08:00
# GitHub Tag Action
A Github Action to automatically bump and tag master, on merge, with the latest SemVer formatted version. Works on any platform.
## Usage
2019-11-01 03:02:20 +08:00
```yaml
2019-11-01 01:36:53 +08:00
name: Bump version
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
2019-11-01 03:02:20 +08:00
- uses: actions/checkout@master
- name: Bump version and push tag
2020-05-28 00:18:53 +08:00
uses: mathieudutour/github-tag-action@v4.5
2019-11-01 03:02:20 +08:00
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
2019-11-01 01:36:53 +08:00
```
### Inputs
- **github_token** _(required)_ - Required for permission to tag the repo. Usually `${{ secrets.GITHUB_TOKEN }}`.
2020-05-27 21:30:18 +08:00
- **default_bump** _(optional)_ - Which type of bump to use when [none is explicitly provided](#bumping) (default: `patch`). You can also set `false` to avoid generating a new tag when none is explicitly provided.
2019-11-01 01:36:53 +08:00
- **tag_prefix** _(optional)_ - A prefix to the tag name (default: `v`).
2020-01-06 23:33:39 +08:00
- **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`... (default: `master`).
- **create_annotated_tag** _(optional)_ - Boolean to create an annotated rather than a lightweight one (default: `false`).
2020-03-29 03:22:44 +08:00
- **dry_run** _(optional)_ - Do not perform taging, just calculate next version and changelog, then exit
2019-11-01 01:36:53 +08:00
### Outputs
2019-11-28 18:58:17 +08:00
- **new_tag** - The value of the newly created tag. Note that if there hasn't been any new commit, this will be `undefined`.
2020-01-11 00:29:30 +08:00
- **new_version** - The value of the newly created tag without the prefix. Note that if there hasn't been any new commit, this will be `undefined`.
2019-11-28 18:58:17 +08:00
- **previous_tag** - The value of the previous tag (or `0.0.0` if none).
2020-02-25 01:55:02 +08:00
- **changelog** - The [conventional changelog](https://github.com/conventional-changelog/conventional-changelog) since the previous tag.
2019-11-01 01:36:53 +08:00
> **_Note:_** This action creates a [lightweight tag](https://developer.github.com/v3/git/refs/#create-a-reference) by default.
2019-11-01 01:36:53 +08:00
2020-01-06 23:33:39 +08:00
### Bumping
The action will parse the new commits since the last tag using the [semantic-release](https://github.com/semantic-release/semantic-release) conventions.
semantic-release uses the commit messages to determine the type of changes in the codebase. Following formalized conventions for commit messages, semantic-release automatically determines the next [semantic version](https://semver.org) number.
By default semantic-release uses [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines).
Here is an example of the release type that will be done based on a commit messages:
| Commit message | Release type |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- |
| `fix(pencil): stop graphite breaking when too much pressure applied` | Patch Release |
| `feat(pencil): add 'graphiteWidth' option` | Minor Release |
| `perf(pencil): remove graphiteWidth option`<br><br>`BREAKING CHANGE: The graphiteWidth option has been removed.`<br>`The default graphite width of 10mm is always used for performance reasons.` | Major Release |
If no commit message contains any information, then **default_bump** will be used.
2019-11-01 01:36:53 +08:00
## Credits
2020-01-06 23:33:39 +08:00
[anothrNick/github-tag-action](https://github.com/anothrNick/github-tag-action) - a similar action using a Dockerfile (hence not working on macOS)