Skip to content

Commit 64fa559

Browse files
[bazel/infra] Add manual BCR release workflow
Signed-off-by: Shameek Ganguly <[email protected]>
1 parent e08a772 commit 64fa559

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

.bcr/metadata.template.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"homepage": "https://github.com/gazebosim/sdformat",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "shameekganguly",
7+
"github_user_id": 2412842,
8+
"name": "Shameek Ganguly"
9+
},
10+
{
11+
"email": "[email protected]",
12+
"github": "mjcarroll",
13+
"github_user_id": 279701,
14+
"name": "Michael Carroll"
15+
}
16+
],
17+
"repository": [
18+
"github:gazebosim/sdformat"
19+
],
20+
"versions": [],
21+
"yanked_versions": {}
22+
}

.bcr/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+
- ubuntu2004
4+
- macos
5+
- macos_arm64
6+
bazel:
7+
- 8.x
8+
- 7.x
9+
tasks:
10+
verify_targets:
11+
name: Verify build targets
12+
platform: ${{ platform }}
13+
bazel: ${{ bazel }}
14+
build_flags:
15+
- '--cxxopt=-std=c++17'
16+
- '--host_cxxopt=-std=c++17'
17+
build_targets:
18+
- '@sdformat'
19+
- '@sdformat//:urdf_parser'

.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}-{TAG}",
4+
"url": "https://github.com/{OWNER}/{REPO}/archive/refs/tags/{TAG}.tar.gz"
5+
}

.github/workflows/publish.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Publish new releases to Bazel Central Registry.
2+
name: Publish to BCR
3+
on:
4+
# For now, the workflow must be manually triggered.
5+
workflow_dispatch:
6+
inputs:
7+
tag_name:
8+
description: git tag being released
9+
required: true
10+
type: string
11+
jobs:
12+
# The publish-to-bcr reusable workflow expects the version name to be in
13+
# semver-(optional build metadata postfix) format, but the repo tags are in
14+
# branch_semver-postfix format. This job extracts the branch name as a prefix
15+
# to pass to publish-to-bcr.
16+
extract_tag_prefix:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
prefix: ${{ steps.extract.outputs.prefix }}
20+
steps:
21+
- name: Extract the tag prefix from the tag name.
22+
id: extract
23+
run: |
24+
branch=$(echo "${{ inputs.tag_name }}" | cut -d'_' -f1)
25+
prefix="${branch}_"
26+
echo "prefix=${prefix}" | tee -a "$GITHUB_OUTPUT"
27+
28+
publish:
29+
needs: extract_tag_prefix
30+
uses: bazel-contrib/publish-to-bcr/.github/workflows/[email protected]
31+
with:
32+
tag_name: ${{ inputs.tag_name }}
33+
# GitHub repository which is a fork of the upstream where the Pull Request will be opened.
34+
registry_fork: gazebo-forks/bazel-central-registry
35+
attest: false
36+
tag_prefix: ${{ needs.extract_tag_prefix.outputs.prefix }}
37+
38+
permissions:
39+
attestations: write
40+
contents: write
41+
id-token: write
42+
secrets:
43+
# Necessary to push to the BCR fork, and to open a pull request against a registry
44+
publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }}

0 commit comments

Comments
 (0)