-
Notifications
You must be signed in to change notification settings - Fork 13
/
justfile
73 lines (61 loc) · 1.97 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
project := "iso8601"
# Run linting and test tasks
default: pre-commit lint test docs
# Run pre-commit
pre-commit COMMAND="run" *ARGS="--all-files":
poetry run pre-commit {{COMMAND}} {{ARGS}}
# Run all linting actions
lint: ruff mypy
# Lint code with ruff
ruff COMMAND="check" *ARGS=".":
poetry run ruff {{COMMAND}} {{ARGS}}
# Check code with Mypy
mypy *ARGS=".":
poetry run mypy {{ARGS}}
# Run tests
test: pytest
# Run pytest tests
pytest *ARGS="-v":
poetry run pytest {{ARGS}}
# Run sphinx build
docs:
poetry run sphinx-build docs docs/_build
# Add a CHANGELOG.md entry, e.g. just changelog-add added "My entry"
changelog-add TYPE ENTRY:
poetry run changelog-manager add {{TYPE}} "{{ENTRY}}"
# Find out what your next released version might be based on the changelog.
next-version:
poetry run changelog-manager suggest
# Build and create files for a release
prepare-release:
#!/bin/bash
set -xeuo pipefail
poetry run changelog-manager release
poetry version $(changelog-manager current)
rm -rvf dist
poetry build
# Tag and release files, make sure you run 'just prepare-release' first.
do-release:
#!/bin/bash
set -xeuo pipefail
VERSION=$(changelog-manager current)
POETRY_VERSION=$(poetry version -s)
if [ "${VERSION}" != "${POETRY_VERSION}" ]; then
echo "Mismatch between changelog version ${VERSION} and poetry version ${VERSION}"
exit 1
fi
git add pyproject.toml CHANGELOG.md
mkdir -p build
poetry run changelog-manager display --version $VERSION > build/release-notes.md
if [ ! -f dist/{{project}}-${VERSION}.tar.gz ]; then
echo "Missing expected file in dist, did you run 'just prepare-release'?"
exit 1
fi
poetry publish --dry-run
git commit -m"Release ${VERSION}"
git tag $VERSION
git push origin $VERSION
git push origin main
gh release create $VERSION --title $VERSION -F build/release-notes.md ./dist/*
poetry publish
rm -rvf ./dist