-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·35 lines (28 loc) · 1.9 KB
/
release.sh
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
#!/bin/bash
# RELEASE UTILITY
# This script helps with the release process on Github (glibc builds for Linux)
mkdir -p ./builds
rm -rf ./builds/*
CLI_VERSION=$(/usr/bin/cat Cargo.toml | egrep "version = (.*)" | egrep -o --color=never "([0-9]+\.?){3}" | head -n 1)
echo "Releasing v$CLI_VERSION for musl & libc x86_64 targets"
# Build a 'musl' release for Linux x86_64
cargo build --release --target=x86_64-unknown-linux-musl --locked
cp -p ./target/x86_64-unknown-linux-musl/release/watchdog-rs ./builds/watchdog-rs-v$CLI_VERSION-x86_64-unknown-linux-musl
./builds/watchdog-rs-v$CLI_VERSION-x86_64-unknown-linux-musl --version
# Build a 'glibc' (GNU) release for Linux x86_64
cargo build --release --target=x86_64-unknown-linux-gnu --locked
cp -p ./target/x86_64-unknown-linux-gnu/release/watchdog-rs ./builds/watchdog-rs-v$CLI_VERSION-x86_64-unknown-linux-glibc
./builds/watchdog-rs-v$CLI_VERSION-x86_64-unknown-linux-glibc --version
# Build the deb archive
mkdir -p ./builds/watchdog-rs_$CLI_VERSION-1_amd64/DEBIAN
echo "Package: watchdog-rs" > ./builds/watchdog-rs_$CLI_VERSION-1_amd64/DEBIAN/control
echo "Version: $CLI_VERSION" >> ./builds/watchdog-rs_$CLI_VERSION-1_amd64/DEBIAN/control
echo "Architecture: amd64" >> ./builds/watchdog-rs_$CLI_VERSION-1_amd64/DEBIAN/control
echo "Maintainer: Kongbytes" >> ./builds/watchdog-rs_$CLI_VERSION-1_amd64/DEBIAN/control
echo "Description: Minimalist & multi-region network monitoring tool written in Rust" >> ./builds/watchdog-rs_$CLI_VERSION-1_amd64/DEBIAN/control
mkdir -p ./builds/watchdog-rs_$CLI_VERSION-1_amd64/usr/local/bin
cp ./builds/watchdog-rs-v$CLI_VERSION-x86_64-unknown-linux-musl ./builds/watchdog-rs_$CLI_VERSION-1_amd64/usr/local/bin/watchdog
(cd ./builds && dpkg-deb --build --root-owner-group watchdog-rs_$CLI_VERSION-1_amd64)
echo "Update the README instructions for v$CLI_VERSION"
echo " ✓ Publish on crates.io"
echo " ✓ Release on Github with Git tag v$CLI_VERSION"