Skip to content

Commit 272f1ab

Browse files
feat(release): add script to publish to BCR (#15298)
* chore: POC of publishing googleapis to BCR via `git tag` WIP * fix: correct syntax for jq command * feat(release): add script to publish to BCR * docs(release): clarify BCR publishing process * chore: restore unwanted changes * chore: correct license header year * chore: use same folder * chore: fix quoting of `$@` * docs: lint release readme
1 parent b1c39a1 commit 272f1ab

File tree

2 files changed

+55
-6
lines changed

2 files changed

+55
-6
lines changed

release/README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,31 @@ project that need to create a new release. We expect the reader to be familiar
1010
the project itself, [git][git-docs], [GitHub][github-guides], and
1111
[semantic versioning](https://semver.org).
1212

13-
## 0. Verify most recent googleapis SHA adheres to policy
13+
## 0. Update googleapis and Publish to BCR
1414

15-
In order to ensure that our released version includes a SHA of the service proto
16-
definitions that is both current and stable ([googleapis-sha-update-policy]),
17-
aim for a commit SHA from 5-7 days ago (TODO(#13062): automate this update
18-
process). Specifying `COMMIT` and `COMMIT_DATE` when running `renovate.sh` can
19-
be used to achieve this.
15+
First, ensure that our release includes a `googleapis` commit that adheres to
16+
our [update policy][googleapis-sha-update-policy]. This generally means aiming
17+
for a commit that is 5-7 days old. You may need to run the `renovate.sh` script
18+
with a specific `COMMIT` and `COMMIT_DATE` to select the desired commit.
19+
20+
Once the `googleapis` commit has been updated in our repository and the change
21+
is merged, run the `release/publish-bcr.sh` script using the same selected
22+
COMMIT. This script will create a Pull Request in the `googleapis/googleapis`
23+
repository to publish our new version to the Bazel Central Registry. You will
24+
need to provide the version number and the corresponding `googleapis` commit SHA
25+
to the script. Oversee the generated PR and ensure it is merged before
26+
proceeding with the release.
27+
28+
```bash
29+
release/publish-bcr.sh --ref "${COMMIT}" --bcr_organization "${your_gh_id}"
30+
```
31+
32+
Note that either `--bcr_organization` or `--bcr_folder` are necessary in order
33+
for the script to use your fork of `bazel-central-registry`. Pushes to the
34+
original `bazelbuild/bazel-central-registry` are not allowed.
35+
36+
You can find more information about running the script in
37+
[its readme](https://github.com/googleapis/googleapis/blob/e1b12be90da62015f0bea9026d217f0abc32cafe/.bcr/README.md)
2038

2139
## 1. Preparing for a release
2240

release/publish-bcr.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2025 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -euo pipefail
18+
19+
tmpdir="/tmp/googleapis-publish-to-bcr"
20+
if [[ ! -d "${tmpdir}" ]]; then
21+
git clone https://github.com/googleapis/googleapis "${tmpdir}"
22+
fi
23+
24+
# Reset folder
25+
pushd "${tmpdir}"
26+
git reset --hard
27+
git clean -d -f
28+
git fetch --all
29+
git checkout master
30+
31+
bash ".bcr/publish-to-bcr.sh" "${@}"

0 commit comments

Comments
 (0)