a github action to check if the current new version is already exists as a git tag. It checks the version in a pyproject.toml file, and if a tag of the version does not exist, it states so in its output. It also fetches the release notes from a changelog.
An example workflow that uses this action to check for new tags and release a new version if it is new:
name: Release new tags
on:
push:
branches:
- main
jobs:
check-tag:
name: check for new tags
runs-on: ubuntu-latest
steps:
- name: check for new version
id: check-version
uses: biocatchltd/gh-actions-is-new-version@latest
- name: release a new version
if: steps.check-tag.outputs.is-new == 'true'
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.check-version.outputs.release-notes }}
tag_name: ${{ steps.check-version.outputs.found-version }}
target_commitish: ${{ github.sha }}
prerelease: ${{ steps.check-tag.outputs.is-prerelease }}toml-path: the path to the TOML file to use to determine the version, default topyproject.tomlchangelog-path: the path to the markdown file to use to determine the version, default toCHANGELOG.mdrelease-prefix: the prefix to be added to the release tag, default to an empty string
is-new: whether the step detected a new versionfound-version: the version detected by the actionrelease-notes: the markdown snippet of the release notes of the version, will be blank if no version is not newis-prerelease: whether the version is detected as a pre-release (currently, all versions with a-in them are considered pre-releases). Will be blank if no version is not new.release-tag: the full tag of the release, including the prefix