|
| 1 | +# Bazel Central Registry Publishing Configuration |
| 2 | + |
| 3 | +This directory contains the configuration files for publishing brotli modules to the Bazel Central Registry (BCR). |
| 4 | + |
| 5 | +## Modules |
| 6 | + |
| 7 | +This repository publishes two modules to BCR: |
| 8 | + |
| 9 | +1. **brotli** (root) - The main Brotli C library |
| 10 | +2. **brotli_go** (go/) - Go bindings for Brotli |
| 11 | + |
| 12 | +Each module has its own set of template files under `.bcr` and `.bcr/go` respectively. |
| 13 | + |
| 14 | +## Files |
| 15 | + |
| 16 | +### Root module (brotli) |
| 17 | +- **metadata.template.json**: Metadata about the brotli module including homepage, maintainers, and repository location |
| 18 | +- **source.template.json**: Template for generating source archive URLs for releases |
| 19 | +- **presubmit.yml**: BCR CI configuration that defines build and test tasks to validate the module |
| 20 | + |
| 21 | +### Go module (brotli_go) |
| 22 | +- **go/metadata.template.json**: Metadata for the brotli_go module |
| 23 | +- **go/source.template.json**: Source configuration with path to the go subdirectory |
| 24 | +- **go/presubmit.yml**: BCR CI configuration for the Go module |
| 25 | + |
| 26 | +### Shared |
| 27 | +- **config.yml**: Configuration specifying both modules via moduleRoots |
| 28 | +- **README.md**: This file |
| 29 | + |
| 30 | +## Setup (One-time) |
| 31 | + |
| 32 | +Before you can publish to BCR, you need to set up the following: |
| 33 | + |
| 34 | +1. **Fork the Bazel Central Registry** |
| 35 | + - Fork https://github.com/bazelbuild/bazel-central-registry to your GitHub account |
| 36 | + |
| 37 | +2. **Create a Personal Access Token** |
| 38 | + - Go to GitHub Settings > Developer settings > Personal access tokens > Tokens (classic) |
| 39 | + - Click "Generate new token (classic)" |
| 40 | + - Select scopes: `repo` and `workflow` |
| 41 | + - Generate the token and copy it |
| 42 | + |
| 43 | +3. **Add the token to repository secrets** |
| 44 | + - Go to the brotli repository Settings > Secrets and variables > Actions |
| 45 | + - Click "New repository secret" |
| 46 | + - Name: `BCR_PUBLISH_TOKEN` |
| 47 | + - Value: Paste the token from step 2 |
| 48 | + - Click "Add secret" |
| 49 | + |
| 50 | +## Publishing Process |
| 51 | + |
| 52 | +To publish new versions of both modules to BCR: |
| 53 | + |
| 54 | +1. Create a GitHub release with a tag (e.g., `v1.2.1`) |
| 55 | +2. Go to the Actions tab in GitHub |
| 56 | +3. Select the "Publish to BCR" workflow |
| 57 | +4. Click "Run workflow" |
| 58 | +5. Enter the release tag name (e.g., `v1.2.1`) |
| 59 | +6. Enter your BCR fork (e.g., `yourusername/bazel-central-registry`) |
| 60 | +7. Click "Run workflow" |
| 61 | + |
| 62 | +The workflow will automatically create pull requests to the Bazel Central Registry for both modules. |
| 63 | + |
| 64 | +## References |
| 65 | + |
| 66 | +- [Bazel Central Registry](https://github.com/bazelbuild/bazel-central-registry) |
| 67 | +- [publish-to-bcr Documentation](https://github.com/bazel-contrib/publish-to-bcr) |
| 68 | +- [Bzlmod User Guide](https://bazel.build/external/module) |
| 69 | +- [Multi-module Publishing](https://github.com/bazel-contrib/publish-to-bcr/tree/main/templates#optional-configyml) |
0 commit comments