• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2
3set -o errexit -o nounset -o pipefail
4
5# Set by GH actions, see
6# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
7TAG=${GITHUB_REF_NAME}
8PREFIX="rules_testing-${TAG:1}"
9ARCHIVE="rules_testing-$TAG.tar.gz"
10# The prefix is chosen to match what GitHub generates for source archives
11git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
12SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
13
14cat << EOF
15WORKSPACE snippet:
16\`\`\`starlark
17load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
18http_archive(
19    name = "rules_testing",
20    sha256 = "${SHA}",
21    strip_prefix = "${PREFIX}",
22    url = "https://github.com/bazelbuild/rules_testing/releases/download/${TAG}/${ARCHIVE}",
23)
24\`\`\`
25EOF
26