Skip to content

Commit 5251c3c

Browse files
committed
Add BCR publishing configuration for brotli and brotli_go modules
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent 5fa73e2 commit 5251c3c

File tree

9 files changed

+184
-0
lines changed

9 files changed

+184
-0
lines changed

.bcr/README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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)

.bcr/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# BCR configuration file for publish-to-bcr
2+
fixedReleaser:
3+
login: eustas
4+
5+
# Publish both the main brotli module and the Go bindings module
6+
moduleRoots:
7+
- "."
8+
- "go"

.bcr/go/metadata.template.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"homepage": "https://github.com/google/brotli",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "eustas",
7+
"name": "Evgenii Kliuchnikov",
8+
"github_user_id": 203457
9+
}
10+
],
11+
"repository": ["github:google/brotli"],
12+
"versions": [],
13+
"yanked_versions": {}
14+
}

.bcr/go/presubmit.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
matrix:
2+
platform:
3+
- debian10
4+
- ubuntu2004
5+
- macos
6+
- macos_arm64
7+
bazel:
8+
- 8.x
9+
- 7.x
10+
- 6.x
11+
tasks:
12+
verify_targets:
13+
name: Verify build targets
14+
platform: ${{ platform }}
15+
bazel: ${{ bazel }}
16+
build_targets:
17+
- '@brotli_go//cbrotli'
18+
test_targets:
19+
- '@brotli_go//cbrotli:cbrotli_test'

.bcr/go/source.template.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"integrity": "",
3+
"strip_prefix": "{REPO}-{VERSION}/go",
4+
"url": "https://github.com/{OWNER}/{REPO}/archive/refs/tags/{TAG}.tar.gz"
5+
}

.bcr/metadata.template.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"homepage": "https://github.com/google/brotli",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "eustas",
7+
"name": "Evgenii Kliuchnikov",
8+
"github_user_id": 203457
9+
}
10+
],
11+
"repository": ["github:google/brotli"],
12+
"versions": [],
13+
"yanked_versions": {}
14+
}

.bcr/presubmit.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
matrix:
2+
platform:
3+
- debian10
4+
- ubuntu2004
5+
- macos
6+
- macos_arm64
7+
- windows
8+
bazel:
9+
- 8.x
10+
- 7.x
11+
- 6.x
12+
tasks:
13+
verify_targets:
14+
name: Verify build targets
15+
platform: ${{ platform }}
16+
bazel: ${{ bazel }}
17+
build_targets:
18+
- '@brotli//:brotli'
19+
- '@brotli//:brotlicommon'
20+
- '@brotli//:brotlidec'
21+
- '@brotli//:brotlienc'

.bcr/source.template.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"integrity": "",
3+
"strip_prefix": "{REPO}-{VERSION}",
4+
"url": "https://github.com/{OWNER}/{REPO}/archive/refs/tags/{TAG}.tar.gz"
5+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Publish to BCR
2+
3+
on:
4+
# Manually trigger the publish workflow
5+
workflow_dispatch:
6+
inputs:
7+
tag_name:
8+
description: Release tag to publish to the Bazel Central Registry
9+
required: true
10+
type: string
11+
registry_fork:
12+
description: Registry fork to push to (e.g., username/bazel-central-registry)
13+
required: true
14+
type: string
15+
16+
jobs:
17+
publish:
18+
permissions:
19+
contents: write
20+
id-token: write
21+
attestations: write
22+
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v2
23+
with:
24+
tag_name: ${{ inputs.tag_name }}
25+
registry_fork: ${{ inputs.registry_fork }}
26+
# Set to false since not using the release_ruleset workflow
27+
attest: false
28+
secrets:
29+
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}

0 commit comments

Comments
 (0)