|
| 1 | +# Bazel Central Registry (BCR) Publishing |
| 2 | + |
| 3 | +This directory contains template files used to publish `proxy-wasm-cpp-sdk` to the [Bazel Central Registry](https://github.com/bazelbuild/bazel-central-registry). |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The BCR publishing automation uses these template files to create new entries in the Bazel Central Registry when a new release is tagged. This allows users to consume this SDK as a Bazel module using `bzlmod`. |
| 8 | + |
| 9 | +## Files |
| 10 | + |
| 11 | +### metadata.template.json |
| 12 | + |
| 13 | +Contains metadata about the module including: |
| 14 | +- Homepage and repository URL |
| 15 | +- Maintainer information (populated from CODEOWNERS) |
| 16 | +- Version tracking |
| 17 | + |
| 18 | +**Note**: The maintainer information is populated from the CODEOWNERS file. The `versions` field is automatically updated by the publishing workflow. |
| 19 | + |
| 20 | +### source.template.json |
| 21 | + |
| 22 | +Defines how to fetch the source code for a release: |
| 23 | +- Source archive URL pattern |
| 24 | +- Archive integrity hash (filled automatically) |
| 25 | +- Strip prefix for archive extraction |
| 26 | + |
| 27 | +### presubmit.yml |
| 28 | + |
| 29 | +Defines tests that run in BCR CI to validate each release: |
| 30 | +- Test targets to build/run |
| 31 | +- Bazel versions to test against |
| 32 | +- Platforms to test on |
| 33 | + |
| 34 | +## Publishing Process |
| 35 | + |
| 36 | +When a new tag is pushed (e.g., `v1.0.0`): |
| 37 | + |
| 38 | +1. The GitHub Actions workflow (`.github/workflows/publish-to-bcr.yml`) is automatically triggered |
| 39 | +2. The workflow uses these template files to generate a BCR entry |
| 40 | +3. A pull request is opened against https://github.com/bazelbuild/bazel-central-registry |
| 41 | +4. Once approved by BCR maintainers, the PR is merged to publish the new version |
| 42 | + |
| 43 | +## Maintainer Instructions |
| 44 | + |
| 45 | +### Prerequisites |
| 46 | + |
| 47 | +1. **Create a Personal Access Token (PAT)**: |
| 48 | + - Go to GitHub Settings > Developer settings > Personal access tokens > Tokens (classic) |
| 49 | + - Click "Generate new token (classic)" |
| 50 | + - Name it something like "BCR Publish Token" |
| 51 | + - Select scopes: `repo` (Full control of private repositories) and `workflow` (Update GitHub Action workflows) |
| 52 | + - Generate and copy the token |
| 53 | + |
| 54 | +2. **Add the token as a repository secret**: |
| 55 | + - Go to your repository Settings > Secrets and variables > Actions |
| 56 | + - Click "New repository secret" |
| 57 | + - Name: `BCR_PUBLISH_TOKEN` |
| 58 | + - Value: Paste your PAT |
| 59 | + - Click "Add secret" |
| 60 | + |
| 61 | +### Creating a Release |
| 62 | + |
| 63 | +1. **Tag a new version**: |
| 64 | + ```bash |
| 65 | + git tag -a v1.0.0 -m "Release v1.0.0" |
| 66 | + git push origin v1.0.0 |
| 67 | + ``` |
| 68 | + |
| 69 | + This will automatically trigger the "Publish to BCR" workflow. |
| 70 | + |
| 71 | +2. **Monitor the publish workflow**: |
| 72 | + - Go to Actions tab in your repository |
| 73 | + - Find the "Publish to BCR" workflow run |
| 74 | + - Ensure it completes successfully |
| 75 | + - Check https://github.com/bazelbuild/bazel-central-registry for the new pull request |
| 76 | + |
| 77 | +3. **Complete the BCR submission**: |
| 78 | + - Review the pull request in the BCR |
| 79 | + - Wait for BCR maintainers to review and merge |
| 80 | + |
| 81 | +### Troubleshooting |
| 82 | + |
| 83 | +- **Workflow fails with authentication error**: Check that `BCR_PUBLISH_TOKEN` secret is set correctly |
| 84 | +- **Workflow fails to create PR**: Ensure you have a fork of bazel-central-registry configured in the workflow |
| 85 | +- **BCR CI fails**: Review the `presubmit.yml` configuration and ensure test targets are correct |
| 86 | +- **Integrity hash mismatch**: Ensure the release archive is created correctly and hasn't been modified |
| 87 | + |
| 88 | +## References |
| 89 | + |
| 90 | +- [Bazel Central Registry](https://github.com/bazelbuild/bazel-central-registry) |
| 91 | +- [publish-to-bcr documentation](https://github.com/bazel-contrib/publish-to-bcr) |
| 92 | +- [Bzlmod User Guide](https://bazel.build/docs/bzlmod) |
0 commit comments