navid/veins / master / .buildkite/scripts/release.sh
release.sh
← .buildkite/scripts · 841 bytes · raw · download
#!/usr/bin/env bash
set -euo pipefail
tag="${VEINSFORGE_TAG:-${BUILDKITE_TAG:-}}"
if [ -z "$tag" ]; then
exit 0
fi
if [ -z "${VEINSFORGE_CI_TOKEN:-}" ]; then
echo "VEINSFORGE_CI_TOKEN is not set; skipping release report" >&2
exit 0
fi
commit="${VEINSFORGE_COMMIT:-${BUILDKITE_COMMIT:-}}"
if [ -z "$commit" ]; then
echo "no Veins commit available for release report" >&2
exit 1
fi
base="${VEINSFORGE_BASE_URL:-https://veinsforge.top}"
body="$(jq -n \
--arg tag "$tag" \
--arg commit "$commit" \
--arg build "${BUILDKITE_BUILD_URL:-}" \
'{tag: $tag, commit: $commit, provider: "buildkite", build_url: $build, artifacts: []}')"
curl -fsS -X POST "${base%/}/api/v1/ci/release" \
-H "Authorization: Bearer ${VEINSFORGE_CI_TOKEN}" \
-H "Content-Type: application/json" \
-d "$body" >/dev/null