mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 07:16:31 +03:00
ci: make sure -dev version suffix is not forgotten after release
Workflow checks that PRs are made only when current version ends with -dev If this fails, a commit bumping the version to -dev should be pushed to main branch.
This commit is contained in:
23
.github/workflows/dev-version.yml
vendored
Normal file
23
.github/workflows/dev-version.yml
vendored
Normal file
@@ -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
|
||||||
23
scripts/check-dev-version.py
Executable file
23
scripts/check-dev-version.py
Executable file
@@ -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()
|
||||||
Reference in New Issue
Block a user