Skip to content

Commit

Permalink
refactor: simplify release
Browse files Browse the repository at this point in the history
Fixes #12
  • Loading branch information
alexeagle committed Dec 11, 2021
1 parent 48b0a77 commit f367702
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 48 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
16 changes: 0 additions & 16 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -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"],
Expand Down
17 changes: 3 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
<https://github.com/aspect-build/bazel-lib/releases>
copy the WORKSPACE snippet into your `WORKSPACE` file.
10 changes: 0 additions & 10 deletions internal_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f367702

Please sign in to comment.