Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .bcr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Bazel Central Registry (BCR) Publishing

This directory contains template files for automated publishing to the [Bazel Central Registry (BCR)](https://github.com/bazelbuild/bazel-central-registry).

## Overview

When a new release tag is created, the GitHub Actions workflow automatically:
1. Generates a BCR entry using these templates
2. Creates attestations for the generated files
3. Opens a pull request against the Bazel Central Registry

## Files

- **metadata.template.json**: Contains repository metadata and maintainer information
- **source.template.json**: Defines the source archive location and format
- **presubmit.yml**: Specifies BCR CI tests to validate the module

## Workflow

The publish workflow is triggered by:
- Release publication (automatic)
- Manual workflow dispatch (for retries or re-publishing)

See `.github/workflows/publish.yaml` and `.github/workflows/release.yml` for the workflow configuration.

## Requirements

The workflow requires a `BCR_PUBLISH_TOKEN` secret to be configured in the repository settings. This should be a GitHub Personal Access Token with:
- `repo` scope
- `workflow` scope

The token should be created by someone with write access to a fork of the bazel-central-registry.

## References

- [Publish to BCR documentation](https://github.com/bazel-contrib/publish-to-bcr)
- [BCR templates](https://github.com/bazel-contrib/publish-to-bcr/tree/main/templates)
- [Bazel Central Registry](https://github.com/bazelbuild/bazel-central-registry)
21 changes: 21 additions & 0 deletions .bcr/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"homepage": "https://github.com/google/flatbuffers",
"maintainers": [
{
"name": "Derek Bailey",
"github": "dbaileychess",
"github_user_id": 1477247
},
{
"name": "mering",
"github": "mering",
"github_user_id": 133344217
}
],
"_comment": "maintainers will be emailed if a BCR release fails; add additional maintainers as needed",
"repository": [
"github:google/flatbuffers"
],
"versions": [],
"yanked_versions": {}
}
44 changes: 44 additions & 0 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
matrix:
bazel:
- 7.x
- 8.x
- 9.*
tasks:
verify_ubuntu2004:
name: Test Ubuntu 20.04
platform: ubuntu2004
bazel: ${{ bazel }}
environment:
CC: clang
SWIFT_VERSION: "5.8"
SWIFT_HOME: "$HOME/swift-$SWIFT_VERSION"
PATH: "$PATH:$SWIFT_HOME/usr/bin"
shell_commands:
- "echo --- Downloading and extracting Swift $SWIFT_VERSION to $SWIFT_HOME"
- "mkdir $SWIFT_HOME"
- "curl -fL https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu2004/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu20.04.tar.gz | tar xvz --strip-components=1 -C $SWIFT_HOME"
build_targets:
- "@flatbuffers//:*"
verify_ubuntu2204:
name: Test Ubuntu 22.04
platform: ubuntu2204
bazel: ${{ bazel }}
environment:
CC: clang
SWIFT_VERSION: "5.8"
SWIFT_HOME: "$HOME/swift-$SWIFT_VERSION"
PATH: "$PATH:$SWIFT_HOME/usr/bin"
shell_commands:
- "echo --- Downloading and extracting Swift $SWIFT_VERSION to $SWIFT_HOME"
- "mkdir $SWIFT_HOME"
- "curl -fL https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu2204/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu22.04.tar.gz | tar xvz --strip-components=1 -C $SWIFT_HOME"
build_targets:
- "@flatbuffers//:*"
verify_macos:
name: Test macOS
platform: macos
bazel: ${{ bazel }}
xcode_version: "15.2"
build_targets:
- "@flatbuffers//:*"
5 changes: 5 additions & 0 deletions .bcr/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"url": "https://github.com/{OWNER}/{REPO}/archive/refs/tags/{TAG}.tar.gz",
"integrity": "",
"strip_prefix": "{REPO}-{VERSION}"
}
39 changes: 39 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish to BCR

on:
# Run the publish workflow after a successful release
workflow_call:
inputs:
tag_name:
required: true
type: string
# In case of problems, let release engineers retry by manually dispatching
# the workflow from the GitHub UI
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name to publish (e.g., v25.2.10)'
required: true
type: string

jobs:
publish:
uses: bazel-contrib/publish-to-bcr/.github/workflows/[email protected]
with:
tag_name: ${{ inputs.tag_name }}
# GitHub repository which is a fork of the upstream where the Pull Request will be opened.
# This should be set to your fork of bazel-central-registry
registry_fork: google/bazel-central-registry
# Enable attestation support
attest: true
# Open the pull request as a draft
draft: true
permissions:
contents: write
# Necessary for attestation
id-token: write
# Necessary for attestation
attestations: write
secrets:
# Necessary to push to the BCR fork, and to open a pull request against a registry
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,18 @@ jobs:
with:
path: ./rust/flexbuffers
registry-token: ${{ secrets.CARGO_TOKEN }}

publish-bcr:
name: Publish to BCR
# Run after all other publish jobs succeed to ensure we only publish to BCR
# if all package publications were successful
needs: [publish-npm, publish-pypi, publish-nuget, publish-maven, publish-maven-kotlin, publish-crates]
uses: ./.github/workflows/publish.yaml
with:
tag_name: ${{ github.event.release.tag_name }}
permissions:
contents: write
id-token: write
attestations: write
secrets:
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}