diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json new file mode 100644 index 00000000..6c48d171 --- /dev/null +++ b/.bcr/metadata.template.json @@ -0,0 +1,22 @@ +{ + "homepage": "https://github.com/gazebosim/gz-sensors", + "maintainers": [ + { + "email": "iche@intrinsic.ai", + "github": "iche033", + "github_user_id": 4000684, + "name": "Ian Chen" + }, + { + "email": "shameek@intrinsic.ai", + "github": "shameekganguly", + "github_user_id": 2412842, + "name": "Shameek Ganguly" + } + ], + "repository": [ + "github:gazebosim/gz-sensors" + ], + "versions": [], + "yanked_versions": {} +} diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml new file mode 100644 index 00000000..f10db936 --- /dev/null +++ b/.bcr/presubmit.yml @@ -0,0 +1,19 @@ +matrix: + platform: + - ubuntu2204 + - macos + - macos_arm64 + bazel: + - 8.x + - 7.x +tasks: + verify_targets: + name: Verify build targets + platform: ${{ platform }} + bazel: ${{ bazel }} + build_flags: + - '--cxxopt=-std=c++17' + - '--host_cxxopt=-std=c++17' + build_targets: + - '@gz-sensors' + - '@gz-sensors//:gz-sensors-all' diff --git a/.bcr/source.template.json b/.bcr/source.template.json new file mode 100644 index 00000000..e68c53b4 --- /dev/null +++ b/.bcr/source.template.json @@ -0,0 +1,5 @@ +{ + "integrity": "", + "strip_prefix": "{REPO}-{TAG}", + "url": "https://github.com/{OWNER}/{REPO}/archive/refs/tags/{TAG}.tar.gz" +} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 00000000..67368a88 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,44 @@ +# Publish new releases to Bazel Central Registry. +name: Publish to BCR +on: + # For now, the workflow must be manually triggered. + workflow_dispatch: + inputs: + tag_name: + description: git tag being released + required: true + type: string +jobs: + # The publish-to-bcr reusable workflow expects the version name to be in + # semver-(optional build metadata postfix) format, but the repo tags are in + # branch_semver-postfix format. This job extracts the branch name as a prefix + # to pass to publish-to-bcr. + extract_tag_prefix: + runs-on: ubuntu-latest + outputs: + prefix: ${{ steps.extract.outputs.prefix }} + steps: + - name: Extract the tag prefix from the tag name. + id: extract + run: | + branch=$(echo "${{ inputs.tag_name }}" | cut -d'_' -f1) + prefix="${branch}_" + echo "prefix=${prefix}" | tee -a "$GITHUB_OUTPUT" + + publish: + needs: extract_tag_prefix + uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v1.0.0 + with: + tag_name: ${{ inputs.tag_name }} + # GitHub repository which is a fork of the upstream where the Pull Request will be opened. + registry_fork: gazebo-forks/bazel-central-registry + attest: false + tag_prefix: ${{ needs.extract_tag_prefix.outputs.prefix }} + + permissions: + attestations: write + contents: write + id-token: write + secrets: + # Necessary to push to the BCR fork, and to open a pull request against a registry + publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }}