Skip to content

Commit

Permalink
release: don't require manual edits to version.bzl
Browse files Browse the repository at this point in the history
Instead the release process should key off the git tag
  • Loading branch information
alexeagle committed Nov 11, 2021
1 parent 2dfacb4 commit c891bbc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ 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
- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: true
files: |
bazel-out/*/bin/*.tar.gz
body_path: release_notes.txt
files: "*.tar.gz"
9 changes: 1 addition & 8 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load(":version.bzl", "VERSION")
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary")

gazelle_binary(
Expand All @@ -15,7 +14,7 @@ gazelle(

# This declares the release artifact users
pkg_tar(
name = "bazel_lib-" + VERSION,
name = "bazel_lib",
srcs = [
"README.md",
"version.bzl",
Expand All @@ -38,9 +37,3 @@ bzl_library(
"@bazel_tools//tools/build_defs/repo:utils.bzl",
],
)

bzl_library(
name = "version",
srcs = ["version.bzl"],
visibility = ["//visibility:public"],
)
3 changes: 0 additions & 3 deletions version.bzl

This file was deleted.

0 comments on commit c891bbc

Please sign in to comment.