Get the difference between two semantic versions using semver-tool
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
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"
...
INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
---|---|---|---|---|
initial_release_type | string | true | "patch" |
Initial release type returned when there are no existing tags. |
OUTPUT | TYPE | DESCRIPTION |
---|---|---|
new_version | string | The current project version |
old_version | string | The previous project version |
release_type | string | The difference between two versions by the release type ( major , minor , patch , prerelease , build ) |
- Free software: MIT license
If you feel generous and want to show some extra appreciation:
This package was created with Cookiecutter using cookiecutter-action
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.