2
0
Fork 0
mirror of https://github.com/bazel-contrib/bazel-lib synced 2024-11-25 11:32:33 +00:00
bazel-lib/.github/workflows/workspace_snippet.sh

37 lines
939 B
Bash
Raw Normal View History

#!/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
TAG=${GITHUB_REF_NAME}
PREFIX="bazel-lib-${TAG:1}"
SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}')
cat << EOF
WORKSPACE snippet:
\`\`\`starlark
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "aspect_bazel_lib",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
url = "https://github.com/aspect-build/bazel-lib/archive/${TAG}.tar.gz",
)
2021-12-18 00:41:59 +00:00
load("@aspect_bazel_lib//lib:repositories", "aspect_bazel_lib_dependencies")
aspect_bazel_lib_dependencies()
# Optional: register the following toolchain to use jq
2021-12-18 00:41:59 +00:00
load("@aspect_bazel_lib//lib:repositories.bzl", "register_jq_toolchains")
register_jq_toolchains(version = "1.6")
\`\`\`
EOF