2021-12-11 19:39:41 +00:00
|
|
|
#!/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}
|
2021-12-11 20:43:57 +00:00
|
|
|
PREFIX="bazel-lib-${TAG:1}"
|
|
|
|
SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}')
|
2021-12-11 19:39:41 +00:00
|
|
|
|
|
|
|
cat << EOF
|
|
|
|
|
2022-06-06 18:19:37 +00:00
|
|
|
## Using Bzlmod:
|
|
|
|
|
2022-06-06 18:56:04 +00:00
|
|
|
1. Enable with \`--experimental_enable_bzlmod\` in \`.bazelrc\`.
|
2022-06-06 18:56:40 +00:00
|
|
|
2. Add to your \`MODULE.bazel\` file:
|
2022-06-06 18:19:37 +00:00
|
|
|
|
2022-06-06 18:56:04 +00:00
|
|
|
\`\`\`starlark
|
2022-06-06 18:19:37 +00:00
|
|
|
bazel_dep(name = "aspect_bazel_lib", version = "${TAG:1}")
|
2022-06-06 18:56:04 +00:00
|
|
|
\`\`\`
|
2022-06-06 18:19:37 +00:00
|
|
|
|
|
|
|
> Read more about bzlmod: <https://blog.aspect.dev/bzlmod>
|
|
|
|
|
|
|
|
## Using WORKSPACE
|
|
|
|
|
|
|
|
Paste this snippet into your `WORKSPACE` file:
|
2021-12-11 19:39:41 +00:00
|
|
|
|
|
|
|
\`\`\`starlark
|
|
|
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
|
|
|
|
|
|
http_archive(
|
|
|
|
name = "aspect_bazel_lib",
|
|
|
|
sha256 = "${SHA}",
|
2021-12-11 20:43:57 +00:00
|
|
|
strip_prefix = "${PREFIX}",
|
2022-02-11 16:03:34 +00:00
|
|
|
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/${TAG}.tar.gz",
|
2021-12-11 19:39:41 +00:00
|
|
|
)
|
2021-12-15 19:51:29 +00:00
|
|
|
|
2022-01-31 00:25:57 +00:00
|
|
|
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")
|
2021-12-15 19:51:29 +00:00
|
|
|
|
|
|
|
aspect_bazel_lib_dependencies()
|
|
|
|
|
2022-04-22 17:37:43 +00:00
|
|
|
\`\`\`
|
|
|
|
|
|
|
|
Optional toolchains:
|
|
|
|
|
|
|
|
\`\`\`starlark
|
|
|
|
# Register the following toolchain to use jq
|
2021-12-15 19:51:29 +00:00
|
|
|
|
2021-12-18 00:41:59 +00:00
|
|
|
load("@aspect_bazel_lib//lib:repositories.bzl", "register_jq_toolchains")
|
2021-12-15 19:51:29 +00:00
|
|
|
|
2022-06-06 19:05:53 +00:00
|
|
|
register_jq_toolchains()
|
2021-12-15 19:51:29 +00:00
|
|
|
|
2022-04-22 17:37:43 +00:00
|
|
|
# Register the following toolchain to use yq
|
|
|
|
|
|
|
|
load("@aspect_bazel_lib//lib:repositories.bzl", "register_yq_toolchains")
|
|
|
|
|
2022-06-06 19:05:53 +00:00
|
|
|
register_yq_toolchains()
|
2021-12-11 19:39:41 +00:00
|
|
|
\`\`\`
|
|
|
|
EOF
|