-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJustfile
More file actions
57 lines (50 loc) · 1.71 KB
/
Justfile
File metadata and controls
57 lines (50 loc) · 1.71 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
_help:
@just -l
# Lint the project
lint:
cargo fmt -- --check
cargo clippy -- -D warnings
# Format the project
fmt:
cargo fmt
# Build the project
build:
cargo build --release
# Test the project
test:
cargo test --all-features
# Run build with hot reload
dev:
@proctor
# Generate release notes from git log since previous tag
release-notes tag="":
#!/usr/bin/env bash
if [ -n "{{ tag }}" ]; then
CURRENT_TAG="{{ tag }}"
else
CURRENT_TAG=$(git describe --tags --exact-match HEAD 2>/dev/null || echo "HEAD")
fi
PREV_TAG=$(git describe --tags --abbrev=0 "$CURRENT_TAG^" 2>/dev/null || echo "")
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
echo "## What's Changed"
echo ""
if [ -n "$PREV_TAG" ]; then
commits=$(git log --pretty=format:"%H" "$PREV_TAG".."$CURRENT_TAG")
else
commits=$(git log --pretty=format:"%H" "$CURRENT_TAG")
fi
for hash in $commits; do
message=$(git log -1 --pretty=format:"%s" "$hash" | perl -pe 's/(`[^`]*`)(*SKIP)(*FAIL)|</</g; s/(`[^`]*`)(*SKIP)(*FAIL)|>/>/g' | sed -E 's/^([a-z]+)(\([^)]*\))?:/**\1\2:**/')
author=$(gh api "/repos/$REPO/commits/$hash" --jq '.author.login // .commit.author.name')
printf '* %s by @%s in %s\n' "$message" "$author" "$hash"
done
# Generate and push release notes from git log since previous tag
push-release-notes tag="":
#!/usr/bin/env bash
if [ -n "{{ tag }}" ]; then
CURRENT_TAG="{{ tag }}"
else
CURRENT_TAG=$(git describe --tags --exact-match HEAD 2>/dev/null || echo "HEAD")
fi
# Update release-notes
gh release edit "${CURRENT_TAG}" --notes-file <(just release-notes "${CURRENT_TAG}")