Skip to content

Commit c891bbc

Browse files
committed
release: don't require manual edits to version.bzl
Instead the release process should key off the git tag
1 parent 2dfacb4 commit c891bbc

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

.github/workflows/release.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,17 @@ jobs:
2020
# Bazelisk will download bazel to here
2121
XDG_CACHE_HOME: ~/.cache/bazel-repo
2222
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //...
23+
- name: Rename release artifact with version
24+
run: cp $(ls bazel-out/*/bin/*.tar.gz | tail -1) "bazel_lib-$(git describe --tags | sed 's/^v//').tar.gz"
25+
# TODO: move this into bazel to produce the file with expand_template rule when it has stamping
26+
- name: Prepare workspace snippet
27+
run: |
28+
echo -e "WORKSPACE snippet:\n\n\`\`\`starlark\nhttp_archive(\n name = \"aspect_bazel_lib\"," > release_notes.txt
29+
echo " sha256 = \"$(shasum -a 256 *.tar.gz | awk '{print $1}')\"," >> release_notes.txt
30+
echo -e " url = \"https://github.com/aspect-build/bazel-lib/releases/download/$(git describe --tags)/$(ls *.tar.gz)\",\n)\n\`\`\`" >> release_notes.txt
2331
- name: Release
2432
uses: softprops/action-gh-release@v1
2533
with:
2634
prerelease: true
27-
files: |
28-
bazel-out/*/bin/*.tar.gz
35+
body_path: release_notes.txt
36+
files: "*.tar.gz"

BUILD.bazel

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
22
load("@rules_pkg//:pkg.bzl", "pkg_tar")
3-
load(":version.bzl", "VERSION")
43
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary")
54

65
gazelle_binary(
@@ -15,7 +14,7 @@ gazelle(
1514

1615
# This declares the release artifact users
1716
pkg_tar(
18-
name = "bazel_lib-" + VERSION,
17+
name = "bazel_lib",
1918
srcs = [
2019
"README.md",
2120
"version.bzl",
@@ -38,9 +37,3 @@ bzl_library(
3837
"@bazel_tools//tools/build_defs/repo:utils.bzl",
3938
],
4039
)
41-
42-
bzl_library(
43-
name = "version",
44-
srcs = ["version.bzl"],
45-
visibility = ["//visibility:public"],
46-
)

version.bzl

-3
This file was deleted.

0 commit comments

Comments
 (0)