Skip to content

Commit 02381ff

Browse files
committed
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.
1 parent 795fe9a commit 02381ff

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/dev-version.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Check that PRs are made against the -dev version.
2+
#
3+
# If this fails, push commit to update the version to -dev to main.
4+
5+
name: Check for -dev version
6+
7+
on:
8+
pull_request:
9+
10+
permissions: {}
11+
12+
jobs:
13+
check_dev_version:
14+
name: Check that current version ends with -dev
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v6
18+
with:
19+
show-progress: false
20+
persist-credentials: false
21+
22+
- name: Run version-checking script
23+
run: scripts/check-dev-version.py

scripts/check-dev-version.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Script to check that current version ends with -dev.
4+
# Meant to be run in CI to check that PRs are made against the -dev version.
5+
# If the version is not -dev, it was forgotten to be updated
6+
# after making a release.
7+
8+
from pathlib import Path
9+
import tomllib
10+
import sys
11+
12+
13+
def main():
14+
with Path("Cargo.toml").open("rb") as fp:
15+
cargo_toml = tomllib.load(fp)
16+
version = cargo_toml["package"]["version"]
17+
if not version.endswith("-dev"):
18+
print(f"Current version {version} does not end with -dev", file=sys.stderr)
19+
sys.exit(1)
20+
21+
22+
if __name__ == "__main__":
23+
main()

0 commit comments

Comments
 (0)