Skip to content

Commit 278a87a

Browse files
authored
feat: publish stardocs on releases (#266)
They will appear on BCR, similar to https://registry.bazel.build/docs/bazelrc-preset.bzl/1.4.0
1 parent c5c3044 commit 278a87a

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

.bcr/source.template.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"integrity": "**leave this alone**",
33
"strip_prefix": "{REPO}-{VERSION}",
4+
"docs_url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.docs.tar.gz",
45
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.tar.gz"
56
}

.github/workflows/release_prep.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ ARCHIVE="rules_ruby-$TAG.tar.gz"
1313
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
1414
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
1515

16+
# Add generated API docs to the release, see https://github.com/bazelbuild/bazel-central-registry/issues/5593
17+
docs="$(mktemp -d)"; targets="$(mktemp)"
18+
bazel --output_base="$docs" query --output=label --output_file="$targets" 'kind("starlark_doc_extract rule", //rails:all //ruby:all)'
19+
bazel --output_base="$docs" build --target_pattern_file="$targets"
20+
tar --create --auto-compress \
21+
--directory "$(bazel --output_base="$docs" info bazel-bin)" \
22+
--file "$GITHUB_WORKSPACE/${ARCHIVE%.tar.gz}.docs.tar.gz" .
23+
1624
# The stdout of this program will be used as the top of the release notes for this release.
1725
cat << EOF
1826
## Using Bzlmod with Bazel 7-8

rails/BUILD.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ bzl_library(
1010
"//rails/private:rails_test_factory",
1111
],
1212
)
13+
14+
starlark_doc_extract(
15+
name = "rails_test_factory.doc_extract",
16+
src = "rails_test_factory.bzl",
17+
deps = [":rails_test_factory"],
18+
)

ruby/BUILD

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ bzl_library(
2424
],
2525
)
2626

27+
starlark_doc_extract(
28+
name = "defs.doc_extract",
29+
src = "defs.bzl",
30+
deps = [":defs"],
31+
)
32+
2733
bzl_library(
2834
name = "deps",
2935
srcs = ["deps.bzl"],
@@ -34,6 +40,12 @@ bzl_library(
3440
],
3541
)
3642

43+
starlark_doc_extract(
44+
name = "deps.doc_extract",
45+
src = "deps.bzl",
46+
deps = [":deps"],
47+
)
48+
3749
bzl_library(
3850
name = "extensions",
3951
srcs = ["extensions.bzl"],

0 commit comments

Comments
 (0)