#!/usr/bin/env bash
#
# This script should be run from the root of the repository.
set -x
# Zip up all the agent binaries to reduce the download size. DEBs and RPMs
# aren't included to be easier to work with.
find dist/ -type f \
-name 'grafana-agent*' -not -name '*.deb' -not -name '*.rpm' \
-exec zip -j -m "{}.zip" "{}" \;
# Sign the RPM packages. DEB packages aren't signed.
./packaging/rpm/gpg-sign.sh
# Get the SHA256SUMS before continuing.
pushd dist && sha256sum -- * > SHA256SUMS && popd || exit
ghr \
-t "${GITHUB_TOKEN}" \
-u "grafana" \
-r "agent" \
-b="$(envsubst < ./tools/release-note.md)" \
-delete -draft \
"${VERSION}" ./dist/