blob: 315ca8f7cb6b562c2a520f10a7eefe21935320dc [file]
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
# Set by GH actions, see
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
readonly TAG=$1
# The prefix is chosen to match what GitHub generates for source archives.
# This guarantees that users can easily switch from a released artifact to a source archive
# with minimal differences in their code (e.g. strip_prefix remains the same)
readonly PREFIX="rules_fuzzing-${TAG}"
readonly ARCHIVE="${PREFIX}.tar.gz"
# NB: configuration for 'git archive' is in /.gitattributes
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
# The stdout of this program will be used as the top of the release notes for this release.
cat << EOF
## Using MODULE.bazel:
\`\`\`starlark
bazel_dep(name = "rules_fuzzing", version = "${TAG:1}")
\`\`\`
## Using WORKSPACE:
\`\`\`starlark
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_fuzzing",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
url = "https://github.com/bazel-contrib/rules_fuzzing/releases/download/${TAG}/${ARCHIVE}",
)
load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies")
rules_fuzzing_dependencies()
load("@rules_fuzzing//fuzzing:init.bzl", "rules_fuzzing_init")
rules_fuzzing_init()
load("@fuzzing_py_deps//:requirements.bzl", "install_deps")
install_deps()
\`\`\`
EOF