forked from spellshift/realm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·59 lines (50 loc) · 1.88 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
VERSION=$1
if [ -z "$VERSION" ]
then
echo "Please specify a version, for example ./release.sh 0.3.0"
exit 2
fi
echo "Now releasing Realm v$VERSION"
echo "Please go get some coffee, this may take a while ☕"
###
## Update Versions
###
echo "[v$VERSION] Updating build versions"
sed -i -E "s/version = \"[0-9].[0-9].[0-9]\"/version = \"$VERSION\"/" implants/imix/Cargo.toml
sed -i -E "s/version = \"[0-9].[0-9].[0-9]\"/version = \"$VERSION\"/" implants/golem/Cargo.toml
sed -i -E "s/version = \"[0-9].[0-9].[0-9]\"/version = \"$VERSION\"/" implants/lib/eldritch/Cargo.toml
sed -i -E "s/version = \"[0-9].[0-9].[0-9]\"/version = \"$VERSION\"/" implants/lib/c2/Cargo.toml
sed -i -E "s/version_string = \"v[0-9].[0-9].[0-9]\"/version_string = \"v$VERSION\"/" implants/imix/src/main.rs
sed -i -E "s/Version = \"v[0-9].[0-9].[0-9]\"/Version = \"v$VERSION\"/" tavern/version.go
###
## Rust Setup
###
echo "[v$VERSION] Installing dependencies"
apt update
apt install -y musl-tools gcc-mingw-w64
###
## Release Imix
###
cd ./implants/imix
echo "[v$VERSION] Building Imix Release $(pwd)"
rustup target add x86_64-unknown-linux-musl
rustup target add x86_64-pc-windows-gnu
RUSTFLAGS="-C target-feature= crt-static" cargo build --release --target=x86_64-unknown-linux-musl
RUSTFLAGS="-C target-feature= crt-static" cargo build --release --target=x86_64-pc-windows-gnu
cd ../..
###
## Release Golem
###
cd ./implants/golem
echo "[v$VERSION] Building Golem Release $(pwd)"
rustup target add x86_64-unknown-linux-musl
rustup target add x86_64-pc-windows-gnu
RUSTFLAGS="-C target-feature= crt-static" cargo build --release --target=x86_64-unknown-linux-musl
RUSTFLAGS="-C target-feature= crt-static" cargo build --release --target=x86_64-pc-windows-gnu
cd ../..
###
## Complete
###
echo "[v$VERSION][WARN] MacOS cannot be cross-compiled yet, please manually build artifacts"
echo "[v$VERSION] Release completed"