package Windows with zip

This commit is contained in:
Kaan Barmore-Genç 2022-01-27 15:04:32 -05:00
parent 7eca3fbe5f
commit 59e4a5e4d9
2 changed files with 9 additions and 5 deletions

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
/target
gandi.toml
*.tar*
*.tar*
*.zip

View file

@ -1,7 +1,7 @@
#!/bin/bash
#
# Make sure `cross` is installed.
# You'll also need `sed`, and a relatively recent version of `tar`.
# You'll also need `sed`, a relatively recent version of `tar`, and `7z`.
#
# This script runs does `sudo docker` to build and push the release to docker.
# If you have rootless docker set up, remove sudo from this variable.
@ -9,7 +9,6 @@ DOCKER="sudo docker"
#
# Trap errors and interrupts
set -Eeuo pipefail
shopt -s extglob
function handle_sigint() {
echo "SIGINT, exiting..."
exit 1
@ -50,7 +49,11 @@ VERSION=$(sed -nr 's/^version *= *"([0-9.]+)"/\1/p' Cargo.toml)
for target in "${!TARGETS[@]}"; do
echo Building "${target}"
cross build -j $(($(nproc) / 2)) --release --target "${target}"
tar -acf "gandi-live-dns.${VERSION}.${TARGETS[${target}]}.tar.xz" target/"${target}"/release/gandi-live-dns?(|.exe)
if [[ "${target}" =~ .*"windows".* ]] ; then
7z a -tzip "gandi-live-dns.${VERSION}.${TARGETS[${target}]}.zip" target/"${target}"/release/gandi-live-dns.exe 1>/dev/null
else
tar -acf "gandi-live-dns.${VERSION}.${TARGETS[${target}]}.tar.xz" target/"${target}"/release/gandi-live-dns
fi
done
# Copy files into place so Docker can get them easily
@ -67,4 +70,4 @@ ${DOCKER} buildx build . \
--file "Dockerfile" \
--tag "seriousbug/gandi-live-dns-rust:latest" \
--tag "seriousbug/gandi-live-dns-rust:${VERSION}" \
--push
--push