|
| 1 | +# BCR Publishing Configuration |
| 2 | + |
| 3 | +This directory contains the template files required for publishing opentelemetry-cpp to the [Bazel Central Registry (BCR)](https://github.com/bazelbuild/bazel-central-registry). |
| 4 | + |
| 5 | +## Files |
| 6 | + |
| 7 | +### metadata.template.json |
| 8 | +Contains the module metadata including homepage, maintainers, and repository information. This is used to create/update the BCR metadata for the module. |
| 9 | + |
| 10 | +### source.template.json |
| 11 | +Defines the source archive location and format. Placeholders like `{OWNER}`, `{REPO}`, `{TAG}`, and `{VERSION}` are automatically replaced during publishing. |
| 12 | + |
| 13 | +### presubmit.yml |
| 14 | +Defines the BCR presubmit tests that run when a new version is published. Currently configured to test on: |
| 15 | +- Platforms: debian10, macos, ubuntu2004, windows |
| 16 | +- Bazel versions: 7.x, 8.x, 9.* |
| 17 | + |
| 18 | +## Publishing Process |
| 19 | + |
| 20 | +The publish-to-bcr workflow (`.github/workflows/publish-to-bcr.yml`) automates publishing to BCR. |
| 21 | + |
| 22 | +### Prerequisites |
| 23 | + |
| 24 | +**Create a Personal Access Token (PAT)**: |
| 25 | + - Create a Classic PAT with `workflow` and `repo` permissions |
| 26 | + - Add it as a secret named `BCR_PUBLISH_TOKEN` in repository settings |
| 27 | + |
| 28 | +### How to Publish |
| 29 | + |
| 30 | +The workflow can be triggered in two ways: |
| 31 | + |
| 32 | +1. **Automatically**: When a new GitHub release is published |
| 33 | +2. **Manually**: Via workflow dispatch in GitHub Actions UI |
| 34 | + - Go to Actions → Publish to BCR → Run workflow |
| 35 | + - Enter the tag name (e.g., `v1.24.0`) |
| 36 | + |
| 37 | +### What Happens |
| 38 | + |
| 39 | +When triggered, the workflow: |
| 40 | +1. Generates a BCR entry using these templates |
| 41 | +2. Pushes the entry to your BCR fork |
| 42 | +3. Opens a pull request against the upstream BCR |
| 43 | + |
| 44 | +### Using a Fork Registry |
| 45 | + |
| 46 | +For development and testing, you can use a fork of the Bazel Central Registry: |
| 47 | + |
| 48 | +1. Fork https://github.com/bazelbuild/bazel-central-registry |
| 49 | +2. Configure your fork URL in the workflow (modify the `publish-to-bcr.yml` file) |
| 50 | +3. Test changes in your fork before submitting to the official BCR |
| 51 | + |
| 52 | +The configuration in this repository points to the **official** Bazel Central Registry at https://github.com/bazelbuild/bazel-central-registry. However, using a fork registry is recommended for testing and development to avoid polluting the official registry during experimentation. |
| 53 | + |
| 54 | +## References |
| 55 | + |
| 56 | +- [Publish to BCR Action](https://github.com/bazel-contrib/publish-to-bcr) |
| 57 | +- [Bazel Central Registry](https://github.com/bazelbuild/bazel-central-registry) |
| 58 | +- [BCR Module: opentelemetry-cpp](https://github.com/bazelbuild/bazel-central-registry/tree/main/modules/opentelemetry-cpp) |
0 commit comments