-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·64 lines (57 loc) · 1.79 KB
/
run.sh
File metadata and controls
executable file
·64 lines (57 loc) · 1.79 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
#!/bin/bash
# @cmd build cargo project
# @alias b
build() {
cargo build --release
}
run() {
./target/release/dp
}
# @cmd mark as releaser
# @arg type![patch|minor|major] Release type
release() {
# echo "release $1"
CURRENT_VERSION=$(grep '^version = ' Cargo.toml | sed -E 's/version = "(.*)"/\1/')
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
echo $argc_type
case $argc_type in
major)
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
;;
minor)
MINOR=$((MINOR + 1))
PATCH=0
;;
patch)
PATCH=$((PATCH + 1))
;;
esac
version="$MAJOR.$MINOR.$PATCH"
LATEST_TAG=$(git tag --list --sort=-version:refname | head -n 1)
if [ -n "$LATEST_TAG" ]; then
# Not the first release - get changes since last tag
changelog=$(git cliff $LATEST_TAG..HEAD --strip all)
git cliff --tag $version $LATEST_TAG..HEAD --prepend CHANGELOG.md
else
# First release - get all changes
changelog=$(git cliff --unreleased --strip all)
git cliff --tag $version --unreleased --prepend CHANGELOG.md
fi
sed -i "s/^version = \".*\"/version = \"$version\"/" Cargo.toml
git add -A && git commit -m "chore(release): prepare for $version"
echo "$changelog"
git tag -a $version -m "$version" -m "$changelog"
git push --follow-tags --force --set-upstream origin develop
gh release create $version --notes "$changelog"
}
# @cmd compile mdbook
# @alias m
# @option --dest_dir <dir> Destination directory
# @flag --monitor Monitor after upload
mdbook() {
mdbook build book --dest-dir ../docs
git add -A && git commit -m "docs: building website/mdbook"
}
eval "$(argc --argc-eval "$0" "$@")"