Skip to content

Commit 3511f30

Browse files
author
Anders Brams
committed
feat: justfile
1 parent 939c260 commit 3511f30

3 files changed

Lines changed: 36 additions & 27 deletions

File tree

README.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,3 @@ client = Client(
172172
)
173173
book = client.get("/books/{book_id}")(params={"book_id": 1})
174174
```
175-
176-
## Releases
177-
178-
Releases are published from the protected `releases` branch. The package version is set manually in `pyproject.toml`, and pushing a release commit to `releases` triggers the GitHub Actions release workflow. The workflow creates the matching `vX.Y.Z` tag after checks pass.
179-
180-
Release steps:
181-
182-
```bash
183-
# 1. Update project.version in pyproject.toml, then commit that change.
184-
uv run python scripts/release.py --version 0.1.0
185-
186-
# 2. If checks pass, push the current commit to the releases branch.
187-
uv run python scripts/release.py --version 0.1.0 --push-release-branch
188-
```

justfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
set shell := ["bash", "-eu", "-o", "pipefail", "-c"]
2+
3+
default:
4+
@just --list
5+
6+
sync:
7+
uv sync --locked --all-packages
8+
9+
format:
10+
uv run ruff check --select I --fix .
11+
uv run ruff format .
12+
13+
format-check:
14+
uv run ruff check --select I .
15+
uv run ruff format --check .
16+
17+
typecheck:
18+
uv run ty check .
19+
20+
test *args:
21+
uv run pytest -n auto {{args}}
22+
23+
check: format-check typecheck test
24+
25+
build:
26+
uv build
27+
28+
release version="":
29+
if [ -n "{{version}}" ]; then \
30+
uv run python scripts/release.py --version "{{version}}"; \
31+
else \
32+
uv run python scripts/release.py; \
33+
fi

scripts/release.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,12 @@ def require_tag_available(tag: str) -> None:
7373

7474
def main() -> None:
7575
parser = argparse.ArgumentParser(
76-
description="Prepare and optionally publish from the releases branch."
76+
description="Run local checks and build distributions before releasing."
7777
)
7878
parser.add_argument(
7979
"--version",
8080
help="Expected version. Defaults to the version in pyproject.toml.",
8181
)
82-
parser.add_argument(
83-
"--push-release-branch",
84-
action="store_true",
85-
help="Push the current commit to origin/releases after release checks pass.",
86-
)
8782
args = parser.parse_args()
8883

8984
version = project_version()
@@ -109,13 +104,8 @@ def main() -> None:
109104
run(["uv", "run", "pytest", "-n", "auto"])
110105
run(["uv", "build"])
111106

112-
if args.push_release_branch:
113-
run(["git", "push", "origin", "HEAD:releases"])
114-
print("Pushed current commit to origin/releases.")
115-
print("GitHub Actions will create the release tag and publish after approval.")
116-
else:
117-
print(f"Release checks passed for {tag}.")
118-
print("Publish with: git push origin HEAD:releases")
107+
print(f"Release checks passed for {tag}.")
108+
print("Publish with: git push origin HEAD:releases")
119109

120110

121111
if __name__ == "__main__":

0 commit comments

Comments
 (0)