diff --git a/.github/workflows/dev-version.yml b/.github/workflows/dev-version.yml new file mode 100644 index 000000000..0d89576e0 --- /dev/null +++ b/.github/workflows/dev-version.yml @@ -0,0 +1,23 @@ +# Check that PRs are made against the -dev version. +# +# If this fails, push commit to update the version to -dev to main. + +name: Check for -dev version + +on: + pull_request: + +permissions: {} + +jobs: + check_dev_version: + name: Check that current version ends with -dev + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + show-progress: false + persist-credentials: false + + - name: Run version-checking script + run: scripts/check-dev-version.py diff --git a/scripts/check-dev-version.py b/scripts/check-dev-version.py new file mode 100755 index 000000000..d2c4270bd --- /dev/null +++ b/scripts/check-dev-version.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +# +# Script to check that current version ends with -dev. +# Meant to be run in CI to check that PRs are made against the -dev version. +# If the version is not -dev, it was forgotten to be updated +# after making a release. + +from pathlib import Path +import tomllib +import sys + + +def main(): + with Path("Cargo.toml").open("rb") as fp: + cargo_toml = tomllib.load(fp) + version = cargo_toml["package"]["version"] + if not version.endswith("-dev"): + print(f"Current version {version} does not end with -dev", file=sys.stderr) + sys.exit(1) + + +if __name__ == "__main__": + main()