diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb9df92..76f242f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,11 +27,13 @@ jobs: # Bazelisk will download bazel to here XDG_CACHE_HOME: ~/.cache/bazel-repo run: ./test.sh - - 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: # Use GH feature to populate the changelog automatically generate_release_notes: true body_path: release_notes.txt + files: bazel-mypy-integration-*.tar.gz + fail_on_unmatched_files: true diff --git a/.github/workflows/workspace_snippet.sh b/.github/workflows/release_prep.sh similarity index 81% rename from .github/workflows/workspace_snippet.sh rename to .github/workflows/release_prep.sh index e6dadc5..f0964c6 100755 --- a/.github/workflows/workspace_snippet.sh +++ b/.github/workflows/release_prep.sh @@ -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-mypy-integration-${TAG}" -SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256 | awk '{print $1}') +ARCHIVE="bazel-mypy-integration-$TAG.tar.gz" +git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE +SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}') cat << EOF WORKSPACE snippet: @@ -17,7 +20,7 @@ http_archive( name = "mypy_integration", sha256 = "${SHA}", strip_prefix = "${PREFIX}", - url = "https://github.com/thundergolfer/bazel-mypy-integration/archive/refs/tags/${TAG}.tar.gz", + url = "https://github.com/thundergolfer/bazel-mypy-integration/releases/download/${TAG}/${ARCHIVE}", ) load(