From f3677026016bacbd033aaef52632764b982f0c8b Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Sat, 11 Dec 2021 10:35:16 -0800 Subject: [PATCH] refactor: simplify release Fixes #12 --- .github/workflows/release.yml | 11 +++-------- BUILD.bazel | 16 ---------------- README.md | 17 +++-------------- internal_deps.bzl | 10 ---------- 4 files changed, 6 insertions(+), 48 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7031b2fa..22f44865c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,17 +20,12 @@ jobs: # Bazelisk will download bazel to here XDG_CACHE_HOME: ~/.cache/bazel-repo run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //... - - name: Rename release artifact with version - run: cp $(ls bazel-out/*/bin/*.tar.gz | tail -1) "bazel_lib-$(git describe --tags | sed 's/^v//').tar.gz" - # TODO: move this into bazel to produce the file with expand_template rule when it has stamping - name: Prepare workspace snippet - run: | - echo -e "WORKSPACE snippet:\n\n\`\`\`starlark\nhttp_archive(\n name = \"aspect_bazel_lib\"," > release_notes.txt - echo " sha256 = \"$(shasum -a 256 *.tar.gz | awk '{print $1}')\"," >> release_notes.txt - echo -e " url = \"https://github.com/aspect-build/bazel-lib/releases/download/$(git describe --tags)/$(ls *.tar.gz)\",\n)\n\`\`\`" >> release_notes.txt + run: .github/workflows/workspace_snippet.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 - files: "*.tar.gz" diff --git a/BUILD.bazel b/BUILD.bazel index 95e70d7e0..e7269d176 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,5 +1,4 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("@rules_pkg//:pkg.bzl", "pkg_tar") load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary") gazelle_binary( @@ -12,21 +11,6 @@ gazelle( gazelle = "gazelle_bin", ) -# This declares the release artifact users -pkg_tar( - name = "bazel_lib", - srcs = [ - "README.md", - "//lib:package_content", - ], - extension = "tar.gz", - # It is all source code, so make it read-only. - mode = "0444", - # Make it owned by root so it does not have the uid of the CI robot. - owner = "0.0", - strip_prefix = ".", -) - bzl_library( name = "internal_deps", srcs = ["internal_deps.bzl"], diff --git a/README.md b/README.md index 3a2900d3c..f5ebd2d3c 100644 --- a/README.md +++ b/README.md @@ -7,17 +7,6 @@ to review PRs there. ## Installation -Include this in your WORKSPACE file: - -```starlark -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "aspect_bazel_lib", - url = "https://github.com/myorg/bazel_lib/releases/download/0.0.0/bazel_lib-0.0.0.tar.gz", - sha256 = "", -) -``` - -> note, in the above, replace the version and sha256 with the one indicated -> in the release notes for bazel_lib -> In the future, our release automation should take care of this. +From the release you wish to use: + +copy the WORKSPACE snippet into your `WORKSPACE` file. diff --git a/internal_deps.bzl b/internal_deps.bzl index 93e00cc0c..c8dd41472 100644 --- a/internal_deps.bzl +++ b/internal_deps.bzl @@ -9,16 +9,6 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def bazel_lib_internal_deps(): "Fetch deps needed for local development" - maybe( - http_archive, - name = "rules_pkg", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz", - "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz", - ], - sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a", - ) - maybe( http_archive, name = "build_bazel_integration_testing",