Skip to content

Commit 4c72d47

Browse files
committed
release: publish release artifact
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 b900a63 commit 4c72d47

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,12 +27,14 @@ jobs:
2727
# Bazelisk will download bazel to here
2828
XDG_CACHE_HOME: ~/.cache/bazel-repo
2929
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //...
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
prerelease: true
3636
# Use GH feature to populate the changelog automatically
3737
generate_release_notes: true
3838
body_path: release_notes.txt
39+
files: rules_oci-*.tar.gz
40+
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="rules_oci-${TAG:1}"
9-
SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}')
10+
ARCHIVE="rules_oci-$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:
@@ -16,7 +19,7 @@ http_archive(
1619
name = "contrib_rules_oci",
1720
sha256 = "${SHA}",
1821
strip_prefix = "${PREFIX}",
19-
url = "https://github.com/bazel-contrib/rules_oci/archive/${TAG}.tar.gz",
22+
url = "https://github.com/bazel-contrib/rules_oci/releases/download/${TAG}/${ARCHIVE}",
2023
)
2124
2225
# Fetches the rules_oci dependencies.

0 commit comments

Comments
 (0)