-
Notifications
You must be signed in to change notification settings - Fork 247
/
Copy pathrelease.sh
executable file
·55 lines (51 loc) · 1.93 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
#!/bin/bash
set -e
baseurl="."
build_type="tarball"
build_platform="$(nix eval --impure --raw --expr 'builtins.currentSystem')"
ref_name_clean=$(echo "${GITHUB_REF_NAME:=vdevel}" | sed -e 's/[^A-Za-z0-9._-]/_/g')
build() {
set -e
network=$1
host="$2"
name="$3"
pkg="cronosd${network}-${build_type}"
if [[ "$host" == "native" ]]; then
if [[ "${build_platform: -6}" == "-linux" ]]; then
# static link for linux targets
FLAKE="${baseurl}#legacyPackages.${build_platform}.pkgsStatic.cronos-matrix.${pkg}"
else
FLAKE="${baseurl}#${pkg}"
fi
else
if [[ "$host" == "aarch64-multiplatform" || "$host" == "gnu64" ]]; then
# static link for linux targets
FLAKE="${baseurl}#legacyPackages.${build_platform}.pkgsCross.${host}.pkgsStatic.cronos-matrix.${pkg}"
else
FLAKE="${baseurl}#legacyPackages.${build_platform}.pkgsCross.${host}.cronos-matrix.${pkg}"
fi
fi
echo "building $FLAKE"
nix build --no-update-lock-file --no-allow-dirty -L "$FLAKE"
cp result "cronos_${ref_name_clean:1}${network}_${name}.tar.gz"
}
if [[ "$build_platform" == "x86_64-linux" ]]; then
hosts="Linux_x86_64,native Linux_arm64,aarch64-multiplatform Windows_x86_64,mingwW64"
elif [[ "$build_platform" == "aarch64-linux" ]]; then
hosts="Linux_arm64,native Linux_x86_64,gnu64 Windows_x86_64,mingwW64"
elif [[ "$build_platform" == "x86_64-darwin" ]]; then
hosts="Darwin_x86_64,native"
elif [[ "$build_platform" == "aarch64-darwin" ]]; then
# cross compiling to x86_64-darwin from aarch64-darwin is not supported
# see: https://github.com/NixOS/nixpkgs/issues/180771
hosts="Darwin_arm64,native"
else
echo "don't support build platform: $build_platform"
exit 1
fi
for network in "" "-testnet"; do
for t in $hosts; do
IFS=',' read name host <<< "${t}"
build "$network" "$host" "$name"
done
done