-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
93 lines (76 loc) · 2.52 KB
/
Justfile
File metadata and controls
93 lines (76 loc) · 2.52 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Run all recipes with Nushell
set shell := ["nu", "-c"]
# ── helpers ───────────────────────────────────────────────────────────────────
# Print current crate version (as seen by Cargo)
version:
#!/usr/bin/env nu
cargo metadata --no-deps --format-version 1
| from json
| get packages.0.version
| str trim
| print $in
# Ensure no uncommitted changes unless ALLOW_DIRTY=true
ensure-clean:
#!/usr/bin/env nu
if (($env.ALLOW_DIRTY? | default "false" | str downcase) == "true") {
print "⚠️ ALLOW_DIRTY=true: skipping clean-tree check"
} else {
if (git status --porcelain | is-empty) {
print "✓ Working tree clean"
} else { print "❌ Working tree not clean. Commit or set ALLOW_DIRTY=true"; exit 1 }
}
# Ensure cargo-edit is present (for cargo set-version)
ensure-cargo-edit:
#!/usr/bin/env nu
if (which cargo-set-version | is-empty) {
cargo install cargo-edit --quiet --force
}
# Run quick checks before publish
preflight:
cargo check
cargo test -q
cargo package -q
# ── main entrypoints ──────────────────────────────────────────────────────────
# Bump {patch|minor|major|<semver>}, commit, tag, publish to crates.io, push to GitHub
# Usage:
# just release patch
# just release minor
# just release major
release level:
#!/usr/bin/env nu
$env.LIBTORCH = '/opt/homebrew/Caskroom/miniconda/base/pkgs/pytorch-2.4.0-py3.11_0/lib/python3.11/site-packages/torch'
$env.DYLD_LIBRARY_PATH = $"($env.LIBTORCH)/lib"
just ensure-clean
just ensure-cargo-edit
# bump version
cargo set-version --bump {{level}}
# read bumped version
let version = (just version | str trim)
print $"🔼 Bumping to v($version)"
# commit & tag
git add Cargo.toml Cargo.lock
git commit -m $"Release v($version)"
git tag $"v($version)"
# sanity checks (build/tests/package), then a dry-run publish
just preflight
print "🚀 Dry run publish…"
cargo publish --dry-run
# real publish
print "📦 Publishing v($version) to crates.io…"
cargo publish
# push branch & tag
print "⬆️ Pushing to GitHub…"
git push origin main
git push origin $"v($version)"
# Convenience shorthands
patch:
just release patch
minor:
just release minor
major:
just release major
# Publish the current version without bumping
publish-only:
just ensure-clean
just preflight
cargo publish