diff --git a/.github/workflows/ci-workflows.yaml b/.github/workflows/ci-workflows.yaml index 33d24adcb..153b9d8a7 100644 --- a/.github/workflows/ci-workflows.yaml +++ b/.github/workflows/ci-workflows.yaml @@ -33,6 +33,15 @@ jobs: aspect-api-token: ${{ secrets.ASPECT_API_TOKEN }} - name: Gazelle run: aspect gazelle --task-key=gazelle + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: aspect-build/setup-aspect@c22a8f64fb38f82f59ce809cd7eb9f8ae096da44 # v2026.23.2 + with: + aspect-api-token: ${{ secrets.ASPECT_API_TOKEN }} + - name: Build API docs + run: bash .github/workflows/release_docs.sh "$RUNNER_TEMP/rules_py-docs.tar.gz" test: name: test (${{ matrix.workspace.path }}, ${{ matrix.bazel.id }}) runs-on: ${{ matrix.workspace.runner }} diff --git a/.github/workflows/release_docs.sh b/.github/workflows/release_docs.sh index d0198b32e..7137bc21b 100755 --- a/.github/workflows/release_docs.sh +++ b/.github/workflows/release_docs.sh @@ -1,12 +1,16 @@ #!/usr/bin/env bash -# Add generated API docs to the release -# see https://github.com/bazelbuild/bazel-central-registry/blob/main/docs/stardoc.md +# Build the generated API docs archive attached to each release, see +# https://github.com/bazelbuild/bazel-central-registry/blob/main/docs/stardoc.md set -o errexit -o nounset -o pipefail docs="$(mktemp -d)" targets="$(mktemp)" out=$1 -bazel --output_base="$docs" query --output=label --output_file="$targets" 'kind("starlark_doc_extract rule", //...)' +bazel --output_base="$docs" query --output=label --output_file="$targets" 'kind("starlark_doc_extract rule", //py/... + //uv/...)' +if [ ! -s "$targets" ]; then + echo "ERROR: no starlark_doc_extract targets found; the release docs archive would be empty" >&2 + exit 1 +fi bazel --output_base="$docs" build --target_pattern_file="$targets" tar --create --auto-compress \ --directory "$(bazel --output_base="$docs" info bazel-bin)" \ diff --git a/.github/workflows/release_prep.sh b/.github/workflows/release_prep.sh index 961e179df..8d1939fce 100755 --- a/.github/workflows/release_prep.sh +++ b/.github/workflows/release_prep.sh @@ -17,12 +17,7 @@ gzip < $ARCHIVE_TMP > $ARCHIVE SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}') # Add generated API docs to the release, see https://github.com/bazelbuild/bazel-central-registry/issues/5593 -# Note, we use xargs here because the repo is on Bazel 7.4 which doesn't have the --output_file flag to bazel query -docs="$(mktemp -d)" -bazel --output_base="$docs" query --output=label 'kind("starlark_doc_extract rule", //py/...)' | xargs bazel --output_base="$docs" build -tar --create --auto-compress \ - --directory "$(bazel --output_base="$docs" info bazel-bin)" \ - --file "$GITHUB_WORKSPACE/${ARCHIVE%.tar.gz}.docs.tar.gz" . +"$(dirname "$0")/release_docs.sh" "$GITHUB_WORKSPACE/${ARCHIVE%.tar.gz}.docs.tar.gz" cat << EOF Add to your \`MODULE.bazel\` file: