Skip to content

Commit f187fe7

Browse files
committed
feat: add BCR publish workflow and release infrastructure
- Add .bcr/ directory with BCR publication templates - metadata.template.json: module metadata and maintainers - source.template.json: release archive configuration - presubmit.yml: BCR validation (mirrors CI exclusions) - README.md: documentation and current status - Add .github/workflows/publish-to-bcr.yml for automated BCR publishing - Add .github/workflows/release.yml for comprehensive release automation - GitHub release creation with git-cliff changelog - Source archive generation with proper versioning - Provenance attestation for supply chain security - Automatic BCR publication trigger Note: BCR publication currently blocked by git_override dependency See GitHub issue #7 for resolution tracking
1 parent 1cff02f commit f187fe7

File tree

6 files changed

+255
-0
lines changed

6 files changed

+255
-0
lines changed

.bcr/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# BCR (Bazel Central Registry) Configuration
2+
3+
This directory contains template files for publishing `rules_wasm_component` to the Bazel Central Registry.
4+
5+
## Status: 🚧 Blocked
6+
7+
**Current Issue**: Publication is blocked due to `git_override` dependency in `MODULE.bazel`.
8+
See [Issue #7](https://github.com/pulseengine/rules_wasm_component/issues/7) for details.
9+
10+
## Files
11+
12+
- **`metadata.template.json`**: Module metadata including maintainers and homepage
13+
- **`source.template.json`**: Source archive configuration
14+
- **`presubmit.yml`**: BCR validation configuration (mirrors our CI exclusions)
15+
- **`README.md`**: This documentation file
16+
17+
## Usage
18+
19+
Once the dependency issue is resolved:
20+
21+
1. Create a GitHub release with proper semantic versioning (e.g., `v1.0.0`)
22+
2. The `.github/workflows/release.yml` workflow will:
23+
- Generate release notes using git-cliff
24+
- Create a source archive
25+
- Publish to GitHub Releases
26+
- Trigger BCR publication via `.github/workflows/publish-to-bcr.yml`
27+
28+
## Prerequisites for BCR Publication
29+
30+
- [ ] Remove `git_override` for `rules_rust` from `MODULE.bazel`
31+
- [ ] Use only official registry dependencies
32+
- [ ] Set up `BCR_PUBLISH_TOKEN` secret in repository settings
33+
- [ ] Create fork of `bazel-central-registry` in the `pulseengine` organization
34+
35+
## Testing
36+
37+
The `presubmit.yml` configuration will test the module on:
38+
- **Platforms**: Ubuntu 20.04/22.04, macOS, Windows
39+
- **Bazel versions**: 7.x, latest
40+
- **Targets**: Core functionality (excludes problematic targets with target triple issues)
41+
42+
## Maintenance
43+
44+
Update the template files when:
45+
- Repository URL changes
46+
- Maintainer list changes
47+
- Testing requirements change
48+
- Archive structure changes

.bcr/metadata.template.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"homepage": "https://github.com/pulseengine/rules_wasm_component",
3+
"maintainers": [
4+
{
5+
"github": "r",
6+
"name": "rules_wasm_component maintainer"
7+
}
8+
],
9+
"repository": [
10+
"github:pulseengine/rules_wasm_component"
11+
]
12+
}

.bcr/presubmit.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
matrix:
2+
platform:
3+
- ubuntu2004
4+
- ubuntu2204
5+
- macos
6+
- windows
7+
bazel:
8+
- 7.x
9+
- latest
10+
tasks:
11+
verify_targets:
12+
name: Verify build targets
13+
platform: ${{ platform }}
14+
bazel: ${{ bazel }}
15+
build_targets:
16+
- "//..."
17+
# Exclude problematic targets
18+
- "-//examples/world_export/..."
19+
- "-//examples/multi_profile/..."
20+
- "-//test_wac/..."
21+
# Exclude wasm_lib targets with target triple issues
22+
- "-//examples/basic:hello_component_wasm_lib_release"
23+
- "-//test/export_macro:test_component_wasm_lib_release"
24+
- "-//test/integration:basic_component_wasm_lib_debug"
25+
- "-//test/integration:basic_component_wasm_lib_release"
26+
- "-//test/integration:consumer_component_wasm_lib_release"
27+
- "-//test/integration:service_a_component_wasm_lib_release"
28+
- "-//test/integration:service_b_component_wasm_lib_release"
29+
- "-//test/integration:wasi_component_wasm_lib_release"
30+
- "-//test/integration:multi_service_system"
31+
- "-//test/integration:wasi_system"
32+
- "-//test/integration:composition_build_test"
33+
- "-//test/integration:integration_tests"
34+
- "-//test/unit:test_component_simple_wasm_lib_release"
35+
- "-//test/unit:test_component_with_deps_wasm_lib_release"
36+
- "-//test/unit:test_composition"
37+
- "-//test_examples/basic:hello_component_wasm_lib_release"
38+
- "-//test_examples/dependencies/consumer:consumer_component_wasm_lib_release"
39+
- "-//test_wit_deps/consumer:consumer_component_wasm_lib_release"
40+
test_targets:
41+
- "//test/integration:basic_component_build_test"
42+
- "//test/integration:basic_component_validation"
43+
- "//test/unit:unit_tests"

.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": "**leave this alone**",
3+
"strip_prefix": "rules_wasm_component-{VERSION}",
4+
"url": "https://github.com/pulseengine/rules_wasm_component/releases/download/{TAG}/rules_wasm_component-{VERSION}.tar.gz"
5+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish to BCR
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
tag_name:
9+
description: "Tag name to publish"
10+
required: true
11+
type: string
12+
13+
permissions:
14+
contents: write
15+
id-token: write
16+
attestations: write
17+
18+
jobs:
19+
publish:
20+
name: Publish to Bazel Central Registry
21+
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v6
22+
with:
23+
tag_name: ${{ inputs.tag_name || github.ref_name }}
24+
registry_fork: pulseengine/bazel-central-registry
25+
attest: true
26+
secrets:
27+
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}

.github/workflows/release.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Tag to release (e.g., v1.0.0)"
11+
required: true
12+
type: string
13+
14+
permissions:
15+
contents: write
16+
id-token: write
17+
attestations: write
18+
19+
jobs:
20+
create_release:
21+
name: Create Release
22+
runs-on: ubuntu-latest
23+
outputs:
24+
tag_name: ${{ steps.get_tag.outputs.tag_name }}
25+
release_archive: ${{ steps.create_archive.outputs.archive_name }}
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Get tag name
34+
id: get_tag
35+
run: |
36+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
37+
echo "tag_name=${{ inputs.tag }}" >> $GITHUB_OUTPUT
38+
else
39+
echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
40+
fi
41+
42+
- name: Install git-cliff
43+
uses: taiki-e/install-action@v2
44+
with:
45+
tool: git-cliff
46+
47+
- name: Generate Release Notes
48+
run: |
49+
# Generate changelog for the latest version
50+
git-cliff --latest --strip header -o RELEASE_NOTES.md
51+
52+
# If no changes found, create a basic release note
53+
if [ ! -s RELEASE_NOTES.md ]; then
54+
echo "## Release ${{ steps.get_tag.outputs.tag_name }}" > RELEASE_NOTES.md
55+
echo "" >> RELEASE_NOTES.md
56+
echo "This release includes improvements and bug fixes for WebAssembly component support in Bazel." >> RELEASE_NOTES.md
57+
fi
58+
59+
echo "Generated release notes:"
60+
cat RELEASE_NOTES.md
61+
62+
- name: Create Release Archive
63+
id: create_archive
64+
run: |
65+
TAG_NAME="${{ steps.get_tag.outputs.tag_name }}"
66+
VERSION=${TAG_NAME#v} # Remove 'v' prefix
67+
ARCHIVE_NAME="rules_wasm_component-${VERSION}.tar.gz"
68+
69+
# Create a clean directory for the release
70+
mkdir -p release_tmp
71+
72+
# Copy files excluding Bazel cache, git, and other build artifacts
73+
rsync -av \
74+
--exclude='.git*' \
75+
--exclude='bazel-*' \
76+
--exclude='*.tar.gz' \
77+
--exclude='.bazel*' \
78+
--exclude='release_tmp' \
79+
--exclude='node_modules' \
80+
--exclude='*.log' \
81+
. release_tmp/rules_wasm_component-${VERSION}/
82+
83+
# Create the archive from the clean directory
84+
tar -czf "$ARCHIVE_NAME" -C release_tmp .
85+
86+
echo "archive_name=$ARCHIVE_NAME" >> $GITHUB_OUTPUT
87+
echo "Created archive: $ARCHIVE_NAME"
88+
ls -la "$ARCHIVE_NAME"
89+
90+
- name: Create GitHub Release
91+
uses: softprops/action-gh-release@v2
92+
with:
93+
tag_name: ${{ steps.get_tag.outputs.tag_name }}
94+
name: Release ${{ steps.get_tag.outputs.tag_name }}
95+
body_path: RELEASE_NOTES.md
96+
files: ${{ steps.create_archive.outputs.archive_name }}
97+
draft: false
98+
prerelease: false
99+
generate_release_notes: true
100+
make_latest: true
101+
102+
- name: Generate Provenance Attestation
103+
uses: actions/attest-build-provenance@v1
104+
with:
105+
subject-path: ${{ steps.create_archive.outputs.archive_name }}
106+
107+
publish_to_bcr:
108+
name: Publish to BCR
109+
needs: create_release
110+
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v6
111+
with:
112+
tag_name: ${{ needs.create_release.outputs.tag_name }}
113+
registry_fork: pulseengine/bazel-central-registry
114+
attest: true
115+
permissions:
116+
contents: write
117+
id-token: write
118+
attestations: write
119+
secrets:
120+
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}

0 commit comments

Comments
 (0)