From d2b71b347df6c8af5c3ee1c833f41b7772e3f250 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Tue, 12 Mar 2024 07:01:58 -0700 Subject: [PATCH] feat: automate publishing releases to Bazel Central Registry (#16014) Note, recent releases on the BCR have a patch set applied, and it seems these patches are developed independently to "fix" each protobuf release, rather than make changes to protobuf repo. The effect of this PR will be to create a *broken* publish to BCR for each protobuf release. At least this red PR on BCR will be our indication that the patches need to be manually replayed there. In parallel, starting with #16013 I'll apply as many of those patches to the protobuf repo as possible. That will reduce the manual effort for each release. Replaces https://github.com/protocolbuffers/protobuf/pull/14565 which originated from my fork so the tests wouldn't run. Closes #16014 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/16014 from protocolbuffers:bcr e17d9c8127274378ca7e711d4ed719473c4adfba PiperOrigin-RevId: 615026796 --- .bcr/README.md | 8 ++++++++ .bcr/metadata.template.json | 23 +++++++++++++++++++++++ .bcr/presubmit.yml | 25 +++++++++++++++++++++++++ .bcr/source.template.json | 5 +++++ 4 files changed, 61 insertions(+) create mode 100644 .bcr/README.md create mode 100644 .bcr/metadata.template.json create mode 100644 .bcr/presubmit.yml create mode 100644 .bcr/source.template.json diff --git a/.bcr/README.md b/.bcr/README.md new file mode 100644 index 0000000000..52271ba315 --- /dev/null +++ b/.bcr/README.md @@ -0,0 +1,8 @@ +# Bazel Central Registry + +When protobuf is released, we want it to be published to the Bazel Central +Registry automatically: + +This folder contains configuration files to automate the publish step. See + +for authoritative documentation about these files. diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json new file mode 100644 index 0000000000..0a4ab6d75f --- /dev/null +++ b/.bcr/metadata.template.json @@ -0,0 +1,23 @@ +{ + "homepage": "https://github.com/protocolbuffers/protobuf", + "maintainers": [ + { + "email": "sandyzhang@google.com", + "github": "zhangskz", + "name": "Sandy Zhang" + }, + { + "email": "mkruskal@google.com", + "github": "mkruskal-google", + "name": "Mike Kruskal" + }, + { + "email": "gberg@google.com", + "github": "googleberg", + "name": "Jerry Berg" + } + ], + "repository": ["github:protocolbuffers/protobuf"], + "versions": [], + "yanked_versions": {} +} diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml new file mode 100644 index 0000000000..a8ed870656 --- /dev/null +++ b/.bcr/presubmit.yml @@ -0,0 +1,25 @@ +matrix: + platform: ["debian10", "macos", "ubuntu2004", "windows"] + +tasks: + verify_targets: + name: "Verify build targets" + platform: ${{ platform }} + build_targets: + - '@protobuf//:protobuf' + - '@protobuf//:protobuf_lite' + - '@protobuf//:protoc' + - '@protobuf//:test_messages_proto2_cc_proto' + - '@protobuf//:test_messages_proto3_cc_proto' + +bcr_test_module: + module_path: "examples" + matrix: + + platform: ["debian10", "macos", "ubuntu2004", "windows"] + tasks: + run_test_module: + name: "Run test module" + platform: ${{ platform }} + build_targets: + - "//..." diff --git a/.bcr/source.template.json b/.bcr/source.template.json new file mode 100644 index 0000000000..ce4bbcce0f --- /dev/null +++ b/.bcr/source.template.json @@ -0,0 +1,5 @@ +{ + "integrity": "**leave this alone**", + "strip_prefix": "{REPO}-{VERSION}", + "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.zip" +}