yq/scripts/xcompile.sh
Matheus Macabu c46c1a7128
build: use goreleaser for building cross-compiled binaries and add riscv64 target (#2135)
* build: use goreleaser to cross-compile binaries for all platforms and archs

The main motivation behind it is because "gox" is unmaintained and archived
and it does not support "linux/riscv64" as a target.

Right now, goreleaser is only building the binaries, and I've tried to replicate
the exact same way the old script does.

In the future, if so desired, goreleaser could be used to further automate the
build and release pipeline by creating the release in GitHub.

* build: create binaries and OCI image for linux/riscv64
2024-08-20 13:09:12 +10:00

36 lines
786 B
Bash
Executable File

#!/bin/bash
set -eo pipefail
# You may need to go install github.com/goreleaser/goreleaser/v2@latest first
GORELEASER="goreleaser build --clean"
if [ -z "$CI" ]; then
GORELEASER+=" --snapshot"
fi
$GORELEASER
cd build
# Remove artifacts from goreleaser
rm artifacts.json config.yaml metadata.json
find . -executable -type f | xargs -I {} tar czvf {}.tar.gz {} yq.1 -C ../scripts install-man-page.sh
tar czvf yq_man_page_only.tar.gz yq.1 -C ../scripts install-man-page.sh
rm yq_windows_386.exe.tar.gz
rm yq_windows_amd64.exe.tar.gz
zip yq_windows_386.zip yq_windows_386.exe
zip yq_windows_amd64.zip yq_windows_amd64.exe
rm yq.1
rhash -r -a . -o checksums
rhash -r -a --bsd . -o checksums-bsd
rhash --list-hashes > checksums_hashes_order
cp ../scripts/extract-checksum.sh .