Skip to content

Commit

Permalink
release: publish release artifact (#93)
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 authored Feb 14, 2023
1 parent 46cda6d commit d54a7d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Release
on:
push:
tags:
- "v*.*.*"
- 'v*.*.*'

jobs:
build:
Expand All @@ -27,12 +27,14 @@ jobs:
# Bazelisk will download bazel to here
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //...
- name: Prepare workspace snippet
run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
- name: Prepare release
run: .github/workflows/release_prep.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: true
# Use GH feature to populate the changelog automatically
generate_release_notes: true
body_path: release_notes.txt
body_path: release_notes.txt
files: rules_webpack-*.tar.gz
fail_on_unmatched_files: true
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +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}
# Strip leading 'v'
# The prefix is chosen to match what GitHub generates for source archives
PREFIX="rules_webpack-${TAG:1}"
SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}')
ARCHIVE="rules_webpack-$TAG.tar.gz"
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')

cat << EOF
WORKSPACE snippet:
Expand All @@ -17,7 +19,7 @@ http_archive(
name = "aspect_rules_webpack",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
url = "https://github.com/aspect-build/rules_webpack/archive/refs/tags/${TAG}.tar.gz",
url = "https://github.com/aspect-build/rules_webpack/releases/download/${TAG}/${ARCHIVE}",
)
EOF

Expand Down

0 comments on commit d54a7d0

Please sign in to comment.