diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..d894ec8 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,35 @@ +# Publish a new release to the Bazel Central Registry (BCR). +# +# Called by release.yml after a release is cut. Can also be run manually from +# the Actions UI ("Run workflow") against a release tag to retry a failed run. +name: Publish to BCR + +on: + workflow_call: + inputs: + tag_name: + required: true + type: string + secrets: + BCR_PUBLISH_TOKEN: + required: true + workflow_dispatch: {} + +jobs: + publish: + permissions: + contents: write + uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v1.4.1 + with: + tag_name: ${{ inputs.tag_name || github.ref_name }} + registry_fork: helly25/bazel-central-registry + # Personal-account PAT: open a draft PR so the author can click "Ready for + # review" to approve it (GitHub forbids reviewing your own PR). + draft: true + # Integrity is computed from the tarball URL in .bcr/source.template.json. + # (The release also produces SLSA attestations; flip attest:true + + # download_default_release_artifacts:true to have the BCR verify them.) + attest: false + download_default_release_artifacts: false + secrets: + publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 110b05b..c7bfaa1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,3 +14,17 @@ jobs: with: release_files: bzl-*.tar.gz prerelease: true + + # Mirror the release to the Bazel Central Registry (replaces the retired + # publish-to-bcr GitHub App). See .github/workflows/publish.yaml. + publish: + needs: release + # Grant what publish.yaml's job requests; a called workflow cannot exceed + # the caller's permissions. + permissions: + contents: write + uses: ./.github/workflows/publish.yaml + with: + tag_name: ${{ github.ref_name }} + secrets: + BCR_PUBLISH_TOKEN: ${{ secrets.BCR_PUBLISH_TOKEN }}