-
Notifications
You must be signed in to change notification settings - Fork 117
Add BCR workflow configuration for Bazel Central Registry publishing #341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mmorel-35
wants to merge
1
commit into
proxy-wasm:main
Choose a base branch
from
mmorel-35:bcr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+173
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # BCR Publishing Templates | ||
|
|
||
| This directory contains templates used by the [Publish to BCR](https://github.com/bazel-contrib/publish-to-bcr) GitHub Action to automatically publish new versions of proxy-wasm-rust-sdk to the [Bazel Central Registry (BCR)](https://github.com/bazelbuild/bazel-central-registry). | ||
|
|
||
| ## Files | ||
|
|
||
| - **metadata.template.json**: Contains repository metadata including homepage, maintainers, and repository location | ||
| - **source.template.json**: Template for generating the source.json file that tells BCR where to download release archives | ||
| - **presubmit.yml**: Defines build and test tasks that BCR will run to verify each published version | ||
|
|
||
| ## How it works | ||
|
|
||
| When a new tag matching the pattern `v*.*.*` is created: | ||
| 1. The GitHub Actions workflow triggers the Publish to BCR action | ||
| 2. The workflow uses these templates to generate a BCR entry | ||
| 3. A pull request is automatically created against the Bazel Central Registry | ||
| 4. Once merged, the new version becomes available to Bazel users via bzlmod | ||
|
|
||
| ## Template Variables | ||
|
|
||
| The following variables are automatically substituted: | ||
| - `{OWNER}`: Repository owner (proxy-wasm) | ||
| - `{REPO}`: Repository name (proxy-wasm-rust-sdk) | ||
| - `{VERSION}`: Version number extracted from the tag (e.g., `0.2.5` from `v0.2.5`) | ||
| - `{TAG}`: Full tag name (e.g., `v0.2.5`) | ||
|
|
||
| ## Setup Requirements | ||
|
|
||
| Before publishing to BCR can work, the following setup is required: | ||
|
|
||
| ### 1. Fork the Bazel Central Registry | ||
|
|
||
| Create a fork of [bazelbuild/bazel-central-registry](https://github.com/bazelbuild/bazel-central-registry) in your GitHub account or organization. This fork is used to create pull requests against the upstream BCR. | ||
|
|
||
| ### 2. Create a Personal Access Token (PAT) | ||
|
|
||
| Create a "Classic" Personal Access Token with the following permissions: | ||
| - **repo**: Full control of private repositories (required to push to the BCR fork) | ||
| - **workflow**: Update GitHub Action workflows (required to trigger workflows) | ||
|
|
||
| To create the token: | ||
| 1. Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic) | ||
| 2. Click "Generate new token (classic)" | ||
| 3. Give it a descriptive name (e.g., "BCR Publish Token") | ||
| 4. Select the `repo` and `workflow` scopes | ||
| 5. Click "Generate token" and copy the token value | ||
|
|
||
| > **Note**: Fine-grained PATs are not fully supported yet because they cannot open pull requests against public repositories. | ||
|
|
||
| ### 3. Configure the Repository Secret | ||
|
|
||
| Add the PAT as a repository secret named `BCR_PUBLISH_TOKEN`: | ||
| 1. Go to your repository Settings → Secrets and variables → Actions | ||
| 2. Click "New repository secret" | ||
| 3. Name: `BCR_PUBLISH_TOKEN` | ||
| 4. Value: Paste the PAT created in step 2 | ||
| 5. Click "Add secret" | ||
|
|
||
| ### 4. Configure the Registry Fork (Optional) | ||
|
|
||
| If your BCR fork is not in the same organization as this repository, you may need to update the workflow in `.github/workflows/publish-to-bcr.yml` to specify the `registry_fork` parameter. | ||
|
|
||
| ## More Information | ||
|
|
||
| - [Publish to BCR documentation](https://github.com/bazel-contrib/publish-to-bcr) | ||
| - [BCR documentation](https://bazel.build/external/registry) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "homepage": "https://github.com/proxy-wasm/proxy-wasm-rust-sdk", | ||
| "maintainers": [ | ||
| { | ||
| "name": "Piotr Sikora", | ||
| "github": "PiotrSikora", | ||
| "github_user_id": 190297 | ||
| } | ||
| ], | ||
| "repository": [ | ||
| "github:proxy-wasm/proxy-wasm-rust-sdk" | ||
| ], | ||
| "versions": [], | ||
| "yanked_versions": {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| matrix: | ||
| platform: | ||
| - debian11 | ||
| - ubuntu2004 | ||
| - ubuntu2004_arm64 | ||
| - macos | ||
| - macos_arm64 | ||
| bazel: | ||
| - 7.x | ||
| - 8.x | ||
| - 9.* | ||
|
|
||
| tasks: | ||
| verify_targets_wasm: | ||
| name: Verify build targets (wasm32-unknown-unknown) | ||
| platform: ${{ platform }} | ||
| bazel: ${{ bazel }} | ||
| build_flags: | ||
| - "--platforms=@rules_rust//rust/platform:wasm" | ||
| build_targets: | ||
| - "@proxy_wasm_rust_sdk//..." | ||
|
|
||
| verify_targets_wasi: | ||
| name: Verify build targets (wasm32-wasip1) | ||
| platform: ${{ platform }} | ||
| bazel: ${{ bazel }} | ||
| build_flags: | ||
| - "--platforms=@rules_rust//rust/platform:wasi" | ||
| build_targets: | ||
| - "@proxy_wasm_rust_sdk//..." | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "integrity": "", | ||
| "strip_prefix": "proxy-wasm-rust-sdk-{VERSION}", | ||
| "url": "https://github.com/{OWNER}/{REPO}/releases/download/v{VERSION}/proxy-wasm-rust-sdk-{VERSION}.tar.gz" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Publishes new releases to the Bazel Central Registry. | ||
| # See .bcr/README.md for more information. | ||
| name: Publish to BCR | ||
|
|
||
| on: | ||
| # Automatically trigger when a version tag is pushed | ||
| push: | ||
| tags: | ||
| - "v*.*.*" | ||
|
|
||
| # Allow manual dispatch from the GitHub UI for retries | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag_name: | ||
| description: "Git tag to publish (e.g., v0.2.5)" | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| publish: | ||
| uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v1.0.0 | ||
| with: | ||
| tag_name: ${{ inputs.tag_name || github.ref_name }} | ||
| permissions: | ||
| attestations: write | ||
| contents: write | ||
| id-token: write | ||
| secrets: | ||
| publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.