-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
70 lines (53 loc) · 1.89 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
export SHELL_COMPLETIONS_DIR := "./pkg/assets/completions"
export MANPAGES_DIR := "./pkg/assets/man"
rustc-version := "1.69.0-x86_64-unknown-linux-gnu"
cargo +args='':
cargo {{args}}
pre-release:
just cargo check \
&& just cargo test \
&& just cargo clippy \
&& just cargo fmt \
&& echo "Pre-Release checks passed!"
verify-clean-git:
test "$(echo `git status --porcelain` | wc -c)" -eq "1"
get-crate-version:
@cat Cargo.toml | rg '^version =' | sed -e 's/^version\s*=\s*//' | tr -d '"'
verify-release-tag-does-not-exist:
VERSION=$(just get-crate-version) \
&& test -z "$(git tag | rg \"v${VERSION}\")" # Error: tag appears to exist already
clean:
rm -rf ./target
build:
cargo build
build-release:
cargo build --release
install:
cargo install --path .
package:
just build-release
rm -rf ./release
mkdir ./release
mv ./target/release ./release
cp -r $MANPAGES_DIR ./release
cp -r $SHELL_COMPLETIONS_DIR ./release
build_release: pre-release
cargo clean
cargo build --release --target x86_64-unknown-linux-gnu
mkdir ./target/release/full-release
cp -r pkg/assets/man ./target/release/full-release
cp -r pkg/assets/completions ./target/release/full-release
export VERSION=$(just get-crate-version)
export RELEASE_PACKAGE="./target/release/powernotd-${VERSION}-x86_64.tar.gz"
tar -czvf $RELEASE_PACKAGE -C target/release/full-release ./target/release/full-release/
md5sum $RELEASE_PACKAGE > ./target/release/powernotd-${VERSION}-checksum.md5
# publish crate version to private registry
publish_crate +args='': verify-clean-git verify-release-tag-does-not-exist pre-release
git push
sleep 0.25
cargo +{{rustc-version}} publish \
--no-default-features {{args}}
echo "adding git tag, now that EVERYTHING worked..."
git tag "v$(just get-crate-version)"
git push --tags
rm -rf target/package