Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit 336aac7

Browse files
authored
release: publish release artifact (#75)
GitHub's stability guarantee for the archive is iffy, and we want metrics on downloads. See bazel-contrib/SIG-rules-authors#11 (comment)
1 parent c82a2d5 commit 336aac7

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ jobs:
2727
# Bazelisk will download bazel to here
2828
XDG_CACHE_HOME: ~/.cache/bazel-repo
2929
run: ./test.sh
30-
- name: Prepare workspace snippet
31-
run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
30+
- name: Prepare release
31+
run: .github/workflows/release_prep.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
3232
- name: Release
3333
uses: softprops/action-gh-release@v1
3434
with:
3535
# Use GH feature to populate the changelog automatically
3636
generate_release_notes: true
3737
body_path: release_notes.txt
38+
files: bazel-mypy-integration-*.tar.gz
39+
fail_on_unmatched_files: true

.github/workflows/workspace_snippet.sh renamed to .github/workflows/release_prep.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ set -o errexit -o nounset -o pipefail
55
# Set by GH actions, see
66
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
77
TAG=${GITHUB_REF_NAME}
8+
# The prefix is chosen to match what GitHub generates for source archives
89
PREFIX="bazel-mypy-integration-${TAG}"
9-
SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}')
10+
ARCHIVE="bazel-mypy-integration-$TAG.tar.gz"
11+
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
12+
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
1013

1114
cat << EOF
1215
WORKSPACE snippet:
@@ -17,7 +20,7 @@ http_archive(
1720
name = "mypy_integration",
1821
sha256 = "${SHA}",
1922
strip_prefix = "${PREFIX}",
20-
url = "https://github.com/thundergolfer/bazel-mypy-integration/archive/refs/tags/${TAG}.tar.gz",
23+
url = "https://github.com/thundergolfer/bazel-mypy-integration/releases/download/${TAG}/${ARCHIVE}",
2124
)
2225
2326
load(

0 commit comments

Comments
 (0)