Skip to content

Commit

Permalink
release: publish release artifact
Browse files Browse the repository at this point in the history
GitHub's stability guarantee for the archive is iffy, and we want metrics on downloads.
See bazel-contrib/SIG-rules-authors#11 (comment)
  • Loading branch information
alexeagle committed Feb 1, 2023
1 parent cb610ef commit dead59b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .bcr/source.template.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "{REPO}-{VERSION}",
"url": "https://github.com/{OWNER}/{REPO}/archive/refs/tags/{TAG}.tar.gz"
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/bazel-lib-{TAG}.tar.gz"
}
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jobs:
with:
# Use GH feature to populate the changelog automatically
generate_release_notes: true
files: /tmp/aspect/release/*
files: |
/tmp/aspect/release/*
bazel-lib-*.tar.gz
body_path: release_notes.txt
token: ${{ secrets.DEREK_BCR_PAT }}
fail_on_unmatched_files: true
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ 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}
# The prefix is chosen to match what GitHub generates for source archives
PREFIX="bazel-lib-${TAG:1}"
SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}')
ARCHIVE="bazel-lib-$TAG.tar.gz"
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')

cat << EOF
Expand All @@ -32,7 +35,7 @@ http_archive(
name = "aspect_bazel_lib",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/${TAG}.tar.gz",
url = "https://github.com/aspect-build/bazel-lib/releases/download/${TAG}/${ARCHIVE}",
)
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")
Expand Down

0 comments on commit dead59b

Please sign in to comment.