https://github.com/tj-actions/semver-diff
:octocat: Github action that compares versions based on the previous semantic version tag and the latest tag i.e (major, minor, patch, prerelease, build)
https://github.com/tj-actions/semver-diff
actions bump2version bumpversion github github-actions semantic-version semantic-versioning semver-release semver-tag versioning
Last synced: 10 months ago
JSON representation
:octocat: Github action that compares versions based on the previous semantic version tag and the latest tag i.e (major, minor, patch, prerelease, build)
- Host: GitHub
- URL: https://github.com/tj-actions/semver-diff
- Owner: tj-actions
- License: mit
- Created: 2021-05-23T21:09:37.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-07T18:28:29.000Z (over 1 year ago)
- Last Synced: 2024-10-10T12:27:56.435Z (over 1 year ago)
- Topics: actions, bump2version, bumpversion, github, github-actions, semantic-version, semantic-versioning, semver-release, semver-tag, versioning
- Language: Shell
- Homepage:
- Size: 194 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://github.com/tj-actions/semver-diff/actions?query=workflow%3ACI)
[](https://github.com/tj-actions/semver-diff/actions?query=workflow%3A%22Update+release+version.%22)
[](https://github.com/search?o=desc\&q=tj-actions+semver-diff+path%3A.github%2Fworkflows+language%3AYAML\&s=\&type=Code)
## semver-diff
Get the difference between two semantic versions using [semver-tool](https://github.com/fsaintjacques/semver-tool)
## Example

## Usage
```yaml
name: Get semver diff
on:
release:
types:
- created
push:
tags:
- v*
jobs:
test:
runs-on: ubuntu-latest
name: semver-diff
steps:
- uses: actions/checkout@v3
- name: Run semver-diff
id: semver-diff
uses: tj-actions/semver-diff@v3
- name: Show release type
run: |
echo "Release type: ${{ steps.semver-diff.outputs.release_type }}"
# Outputs: Release type: major || minor || patch || prerelease || build
```
#### Using [bump2version](https://github.com/c4urself/bump2version)
```yaml
name: Upload Python Package
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run semver-diff
id: semver-diff
uses: tj-actions/semver-diff@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.6.x'
- name: Install dependencies
...
- name: Setup git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: bumpversion
run: |
bump2version "${{ steps.semver-diff.outputs.release_type }}"
git switch -c main
- name: Build and publish to PyPi
...
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
base: "main"
...
```
## Inputs
| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|----------------------------------------------------------------------------------------------|--------|----------|-----------|---------------------------------------------------------------------|
| [initial\_release\_type](#input_initial_release_type) | string | true | `"patch"` | Initial release type returned when
there are no existing tags. |
## Outputs
| OUTPUT | TYPE | DESCRIPTION |
|------------------------------------------------------------------------|--------|-----------------------------------------------------------------------------------------------------------------|
| [new\_version](#output_new_version) | string | The current project version |
| [old\_version](#output_old_version) | string | The previous project version |
| [release\_type](#output_release_type) | string | The difference between two versions
by the release type (`major`, `minor`, `patch`, `prerelease`, `build`) |
* Free software: [MIT license](LICENSE)
If you feel generous and want to show some extra appreciation:
[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee]
[buymeacoffee]: https://www.buymeacoffee.com/jackton1
[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png
## Credits
This package was created with [Cookiecutter](https://github.com/cookiecutter/cookiecutter) using [cookiecutter-action](https://github.com/tj-actions/cookiecutter-action)
## Report Bugs
Report bugs at https://github.com/tj-actions/semver-diff/issues.
If you are reporting a bug, please include:
* Your operating system name and version.
* Any details about your workflow that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.