Skip to content

Commit a681651

Browse files
alexeaglearrdem
andauthored
feat: publish stardocs on releases (#672)
Co-authored-by: Reid D. McKenzie <[email protected]>
1 parent 63547de commit a681651

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
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/publish.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ on:
2020
type: string
2121
jobs:
2222
publish:
23-
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v0.2.1
23+
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v1.0.0
2424
with:
25-
tag_name: ${{ inputs.tag_name }}
25+
tag_name: ${{ inputs.tag_name || github.ref_name }}
2626
# GitHub repository which is a fork of the upstream where the Pull Request will be opened.
2727
registry_fork: aspect-build/bazel-central-registry
2828
draft: false

.github/workflows/release_prep.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ tar --file $ARCHIVE_TMP --append ${PREFIX}/tools/integrity.bzl
4040
gzip < $ARCHIVE_TMP > $ARCHIVE
4141
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
4242

43+
# Add generated API docs to the release, see https://github.com/bazelbuild/bazel-central-registry/issues/5593
44+
# Note, we use xargs here because the repo is on Bazel 7.4 which doesn't have the --output_file flag to bazel query
45+
docs="$(mktemp -d)"
46+
bazel --output_base="$docs" query --output=label 'kind("starlark_doc_extract rule", //py/...)' | xargs bazel --output_base="$docs" build
47+
tar --create --auto-compress \
48+
--directory "$(bazel --output_base="$docs" info bazel-bin)" \
49+
--file "$GITHUB_WORKSPACE/${ARCHIVE%.tar.gz}.docs.tar.gz" .
50+
4351
cat << EOF
4452
## Using [Bzlmod] with Bazel 6:
4553

0 commit comments

Comments
 (0)