2024-01-09 11:33:00 +00:00
|
|
|
#!/bin/bash
|
2024-11-11 21:36:27 +00:00
|
|
|
TAG_VERSION=$(git describe --tags --always --match "[0-9][0-9][0-9][0-9].*.*")
|
|
|
|
OUT_VERSION=$(echo $TAG_VERSION | sed -E 's/([0-9]{4}\.[0-9]{1,2}\.[0-9]+-[0-9]+).*/\1/')
|
|
|
|
echo $TAG_VERSION
|
2021-11-09 11:37:51 +00:00
|
|
|
|
2024-01-08 10:34:40 +00:00
|
|
|
# Disable FIPS module in go-boring
|
|
|
|
export GOEXPERIMENT=noboringcrypto
|
2024-01-09 11:33:00 +00:00
|
|
|
export CGO_ENABLED=0
|
2021-11-09 11:37:51 +00:00
|
|
|
|
2021-07-22 15:36:49 +00:00
|
|
|
# This controls the directory the built artifacts go into
|
2024-08-05 09:44:33 +00:00
|
|
|
export ARTIFACT_DIR=artifacts/
|
2021-07-22 15:36:49 +00:00
|
|
|
mkdir -p $ARTIFACT_DIR
|
|
|
|
|
2022-06-20 11:05:03 +00:00
|
|
|
linuxArchs=("386" "amd64" "arm" "armhf" "arm64")
|
2021-07-22 15:36:49 +00:00
|
|
|
export TARGET_OS=linux
|
2021-11-09 11:37:51 +00:00
|
|
|
for arch in ${linuxArchs[@]}; do
|
2022-06-20 11:05:03 +00:00
|
|
|
unset TARGET_ARM
|
2021-07-22 15:36:49 +00:00
|
|
|
export TARGET_ARCH=$arch
|
2024-01-15 21:16:34 +00:00
|
|
|
|
2024-01-22 11:23:14 +00:00
|
|
|
## Support for arm platforms without hardware FPU enabled
|
2024-01-15 21:16:34 +00:00
|
|
|
if [[ $arch == arm ]] ; then
|
|
|
|
export TARGET_ARCH=arm
|
2024-01-22 11:23:14 +00:00
|
|
|
export TARGET_ARM=5
|
2024-01-15 21:16:34 +00:00
|
|
|
fi
|
2022-06-20 11:05:03 +00:00
|
|
|
|
|
|
|
## Support for armhf builds
|
|
|
|
if [[ $arch == armhf ]] ; then
|
|
|
|
export TARGET_ARCH=arm
|
|
|
|
export TARGET_ARM=7
|
|
|
|
fi
|
|
|
|
|
2021-07-22 15:36:49 +00:00
|
|
|
make cloudflared-deb
|
2024-11-11 21:36:27 +00:00
|
|
|
mv cloudflared\_$TAG_VERSION\_$arch.deb $ARTIFACT_DIR/cloudflared-$OUT_VERSION-linux-$arch.deb
|
2021-07-30 11:29:51 +00:00
|
|
|
|
2021-11-09 11:37:51 +00:00
|
|
|
# rpm packages invert the - and _ and use x86_64 instead of amd64.
|
2024-11-11 21:36:27 +00:00
|
|
|
RPMVERSION=$(echo $TAG_VERSION|sed -r 's/-/_/g')
|
2021-07-30 11:29:51 +00:00
|
|
|
RPMARCH=$arch
|
|
|
|
if [ $arch == "amd64" ];then
|
|
|
|
RPMARCH="x86_64"
|
|
|
|
fi
|
2021-08-04 07:18:43 +00:00
|
|
|
if [ $arch == "arm64" ]; then
|
|
|
|
RPMARCH="aarch64"
|
|
|
|
fi
|
2021-07-22 15:36:49 +00:00
|
|
|
make cloudflared-rpm
|
2024-11-11 21:36:27 +00:00
|
|
|
mv cloudflared-$RPMVERSION-1.$RPMARCH.rpm $ARTIFACT_DIR/cloudflared-$OUT_VERSION-linux-$RPMARCH.rpm
|
2021-07-30 11:29:51 +00:00
|
|
|
|
|
|
|
# finally move the linux binary as well.
|
2024-11-11 21:36:27 +00:00
|
|
|
mv ./cloudflared $ARTIFACT_DIR/cloudflared-$OUT_VERSION-linux-$arch
|
2021-07-22 15:36:49 +00:00
|
|
|
done
|