Skip to content

chore: use publish to bcr reusable workflow for bcr mirroring#3775

Open
kormide wants to merge 1 commit intobazelbuild:mainfrom
kormide:publish-to-bcr-workflow
Open

chore: use publish to bcr reusable workflow for bcr mirroring#3775
kormide wants to merge 1 commit intobazelbuild:mainfrom
kormide:publish-to-bcr-workflow

Conversation

@kormide
Copy link
Contributor

@kormide kormide commented Dec 13, 2025

Migrate rules_rust off of the deprecated Publish to BCR GitHub app to the newer reusable workflow. The reusable workflow has a number of benefits over the app:

  • It supports build attestations which can be enabled at a later time.
  • Gives finer grain control over running the publish process—if it fails, you can manually re-run the workflow.
  • It's more secure—you control the PAT rather than giving the app write permissions.

Some actions that maintainer for this ruleset will need to take:

  • Add a classic PAT named BCR_PUBLISH_TOKEN for the repository or org (see steps). I recommend creating a "machine" user for bazelbuild and generating a classic PAT for that user rather than using an individual's PAT. For example, in bazel-contrib we use the bazel-contrib-bot user to do publishes.
  • Uninstall the GitHub app for this repo.
  • Test a publish after landing, or wait for the next release. I'll be available to help debug any issues that come up if the workflow fails.

Comment on lines -1 to -3
fixedReleaser:
login: scentini
email: 11149636+scentini@users.noreply.github.com
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fixed releaser is no longer required with the workflow because the identity of the publish token is now the actor who opens the PR on the BCR.

@kormide kormide marked this pull request as ready for review December 13, 2025 00:28
@kormide
Copy link
Contributor Author

kormide commented Dec 13, 2025

@UebelAndre @illicitonion

@kormide kormide force-pushed the publish-to-bcr-workflow branch 3 times, most recently from bf77d17 to 72bb93c Compare December 13, 2025 07:05
@UebelAndre
Copy link
Collaborator

@krasimirgg @scentini as Googlers, can you provide the access token?

@kormide
Copy link
Contributor Author

kormide commented Jan 7, 2026

Updated the instructions in the PR description to recommend creating a machine user for bazelbuild and using that user to generate a classic PAT. We do this for bazel-contrib and aspect-build and have associated bot users like https://github.com/bazel-contrib-bot.

@meteorcloudy meteorcloudy self-requested a review March 4, 2026 15:00
@meteorcloudy
Copy link
Member

We already have the token set up at the org level. rules_cc is using it https://github.com/bazelbuild/rules_cc/blob/01a1eced1d61670e3fe1310ccaaa45635aaf90b1/.github/workflows/publish.yaml#L35

# Tags don't include a "v" prefix
tag_prefix: ""
# GitHub repository which is a fork of the upstream where the Pull Request will be opened.
registry_fork: scentini/bazel-central-registry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use bazel-io here

description: Override the ref to read .bcr templates from
jobs:
publish:
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v1.1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the latest version here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v1.1.0 is the latest version

jobs:
publish:
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v1.1.0
with:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a consistent user we can use for the commit? Since releases are triggered by changes to version.bzl it would result in random users being the commit author for the release

draft: false
author_name: bazel-io
author_email: bazel-iot@users.noreply.github.com

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meteorcloudy I made this author info up so can you provide the real credentials?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curl https://api.github.com/users/bazel-io shows a null email. It's either not public or doesn't have an email because it's a machine user?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually @UebelAndre this is referring to the git committer and author, not who opens the PR. That depends on the PAT used. Which should be bazel-io's?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the author info.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kormide I don't want the author to be a random contributor who happened to trigger the releases. I think it should be a consistent user. A bot preferably but if not that then a Googler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I thought you were concerned about the author of the PR. For the author of the commit, sure, just let me know what to put there and I'll change it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @scentini who might also be able to provide this info.

@kormide kormide force-pushed the publish-to-bcr-workflow branch from 72bb93c to 7f2aa93 Compare March 5, 2026 19:13
@kormide kormide force-pushed the publish-to-bcr-workflow branch from 7f2aa93 to 1f83fab Compare March 5, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants