forked from drone-os/drone-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
58 lines (49 loc) · 1.78 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
# Install dependencies
deps:
type cargo-readme >/dev/null || cargo +stable install cargo-readme
# Reformat the source code
fmt:
cargo fmt
# Check the source code for mistakes
lint:
cargo clippy --all
# Build the documentation
doc:
cargo doc --all
# Open the documentation in a browser
doc-open: doc
cargo doc --package drone-core --open
# Run the tests
test:
cargo test --all --exclude drone-core
cargo test --features std --package drone-core
# Update README.md
readme:
cargo readme -o README.md
# Bump the versions
version-bump version drone-version:
sed -i "s/\(api\.drone-os\.com\/drone-core\/\)[0-9]\+\(\.[0-9]\+\)\+/\1$(echo {{version}} | sed 's/\(.*\)\.[0-9]\+/\1/')/" \
Cargo.toml ctypes/Cargo.toml macros/Cargo.toml macros-core/Cargo.toml src/lib.rs
sed -i '/\[.*\]/h;/version = ".*"/{x;s/\[package\]/version = "{{version}}"/;t;x}' \
Cargo.toml ctypes/Cargo.toml macros/Cargo.toml macros-core/Cargo.toml
sed -i '/\[.*\]/h;/version = "=.*"/{x;s/\[.*drone-.*\]/version = "={{version}}"/;t;x}' \
Cargo.toml macros/Cargo.toml
sed -i '/\[.*\]/h;/version = ".*"/{x;s/\[.*drone-config\]/version = "{{drone-version}}"/;t;x}' \
macros/Cargo.toml
sed -i 's/\(drone-core.*\)version = "[^"]\+"/\1version = "{{version}}"/' \
src/lib.rs
# Publish to crates.io
publish:
cd ctypes && cargo publish
cd macros-core && cargo publish
sleep 30
cd macros && cargo publish
sleep 30
cargo publish
# Publish the docs to api.drone-os.com
publish-doc: doc
dir=$(sed -n 's/.*api\.drone-os\.com\/\(.*\/.*\)\/.*\/"/\1/;T;p' Cargo.toml) \
&& rm -rf ../drone-api/$dir \
&& cp -rT target/doc ../drone-api/$dir \
&& echo '<!DOCTYPE html><meta http-equiv="refresh" content="0; URL=./drone_core">' > ../drone-api/$dir/index.html \
&& cd ../drone-api && git add $dir && git commit -m "Docs for $dir"