Skip to content

Commit ba302a6

Browse files
authored
ci: publish stable protos to Buf (#5208)
* ci: publish stable protos to buf Signed-off-by: Simon Scatton <sscatton@nvidia.com> * ci: scope buf push to public protos Signed-off-by: Simon Scatton <sscatton@nvidia.com> --------- Signed-off-by: Simon Scatton <sscatton@nvidia.com>
1 parent 255e168 commit ba302a6

6 files changed

Lines changed: 48 additions & 3 deletions

File tree

‎.agents/skills/release-captain/SKILL.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ tag, or start a second `Pre-release` run for a tag; it has no concurrency guard.
4141
- `Release` (`release.yml`) is dispatched by hand with the stable version. It
4242
picks the highest `-pre.N` on `main` whose whole `Pre-release` run passed,
4343
creates the stable tag on that commit, and publishes without requalifying.
44+
- Stable releases publish public schemas to `buf.build/openshell/core` with
45+
the release tag as the label; prereleases skip Buf publication. The Buf
46+
repository must exist and Actions must have a `BUF_TOKEN` secret with write
47+
access. A failed Buf push fails the release run; follow Recovery before
48+
rerunning the failed publication job.
4449

4550
## Setup
4651

‎.github/workflows/release-publish.yml‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ on:
3636
required: true
3737
type: string
3838
secrets:
39+
BUF_TOKEN:
40+
required: false
3941
SNAPCRAFT_STORE_CREDENTIALS:
4042
required: false
4143
FERN_TOKEN:
@@ -508,6 +510,31 @@ jobs:
508510
retention-days: 90
509511
if-no-files-found: error
510512

513+
publish-protos:
514+
name: Publish Protobuf Schemas
515+
needs: release
516+
if: ${{ !inputs.is-prerelease }}
517+
runs-on: ubuntu-latest
518+
timeout-minutes: 10
519+
permissions:
520+
contents: read
521+
steps:
522+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
523+
with:
524+
persist-credentials: false
525+
ref: ${{ inputs.source-sha }}
526+
527+
- uses: ./.github/actions/setup-nix
528+
529+
- name: Push release schemas to Buf
530+
env:
531+
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
532+
SOURCE_CONTROL_URL: ${{ github.server_url }}/${{ github.repository }}/commit/${{ inputs.source-sha }}
533+
run: |
534+
nix develop -c \
535+
buf push proto --label "${RELEASE_TAG}" \
536+
--source-control-url "${SOURCE_CONTROL_URL}"
537+
511538
publish-snap:
512539
name: Publish Snap
513540
needs: release

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ jobs:
158158
is-prerelease: false
159159
make-latest: ${{ needs.promote.outputs.make-latest == 'true' }}
160160
secrets:
161+
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
161162
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
162163
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
163164
GITLAB_CI_TRIGGER_TOKEN: ${{ secrets.GITLAB_CI_TRIGGER_TOKEN }}

‎CI.md‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,16 @@ parallel within the same run, using native job dependencies.
342342
Its platform package artifacts are uploaded after versioned images and the chart,
343343
so the installer can use them while qualification runs or after it fails.
344344
The pre-release snap artifact is published to the `latest/beta` channel.
345+
Stable release publication pushes the public `proto/` module to
346+
`buf.build/openshell/core`, labeled with the release tag (for example,
347+
`v0.1.7`) and linked to the release source commit. Prereleases do not publish
348+
schemas to Buf.
349+
The unnamed storage module under `crates/openshell-server/proto/` is excluded.
350+
Create the `openshell/core` repository in Buf before publishing and configure the
351+
GitHub Actions secret `BUF_TOKEN` with a token that can write to that repository.
352+
Publication runs inside the release workflow so tags created with `GITHUB_TOKEN`
353+
are covered; it does not depend on a separate tag-push event. A failed Buf push
354+
fails publication and can be retried by rerunning the failed job.
345355
The implemented `release-tag-v1` profile is an incremental subset of RFC 0014
346356
qualification. Failed checks fail the parent workflow and retain evidence in Actions.
347357

@@ -691,7 +701,7 @@ These workflows run after merge to publish dev/tagged artifacts and verify them.
691701
| `.github/workflows/release-auto-tag.yml` | Weekdays at 14:00 Europe/Zurich, tags the next `-pre.N` on `main` when commits landed since the latest one, then dispatches Pre-release. It skips when the train has no `-pre.1` or its version is already stable, so push each train's `-pre.1` tag by hand. |
692702
| `.github/workflows/release-prerelease.yml` | Pre-release orchestrator, triggered by prerelease tag pushes or dispatched by Release Auto-Tag or manually. A tagless dispatch creates the next candidate on its branch; explicit tags select existing candidates. Builds, then publishes and qualifies in parallel. Qualification failure fails the run and sends the failure notification; published artifacts remain available. |
693703
| `.github/workflows/release-build.yml` | Shared version computation, binary and image builds, and package builds. Validates that the tag matches the caller's release kind. |
694-
| `.github/workflows/release-publish.yml` | Shared artifact assembly, OCI image tags and Helm chart publication, and package publication. Stable releases also publish to GitHub Releases, snap, npm, PyPI, and Fern. |
704+
| `.github/workflows/release-publish.yml` | Shared artifact assembly, OCI image tags and Helm chart publication, and package publication. Stable releases also publish release-labeled public schemas to Buf (`BUF_TOKEN` required), GitHub Releases, snap, npm, PyPI, and Fern. |
695705
| `.github/workflows/release-notes.yml` | Shared prompt-driven release notes generation through Inference Hub, used by prerelease previews, notes-only previews, and stable releases. Stable releases reuse the promoted prerelease's preview when available. |
696706
| `.github/workflows/release-qualification.yml` | Reusable qualification suites and result aggregation. Runs security scans, conformance and feature integration, Docker and VM E2E, protobuf compatibility, and advisory compatibility review. |
697707
| `.github/workflows/snap-package.yml` | Builds snap and component artifacts for Release Dev, Release, and Pre-release without Store credentials or publication. |

‎buf.yaml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# Repo-level buf module. Declares proto/ as the single module so buf generate,
4+
# Repo-level buf workspace. Declares public and storage modules so buf generate,
55
# buf lint, buf breaking, and the editor LSP all resolve imports the same way.
66
# Code generation lives with each consumer (see sdk/go/buf.gen.yaml,
7-
# sdk/typescript/buf.gen.yaml); this file owns the module boundary and proto
7+
# sdk/typescript/buf.gen.yaml); this file owns the module boundaries and proto
88
# validation policy.
99
version: v2
1010
modules:
1111
- path: proto
12+
name: buf.build/openshell/core
1213
- path: crates/openshell-server/proto
1314
lint:
1415
use:

‎flake.nix‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
yq-go
7575
zizmor
7676
zstd
77+
buf
7778
];
7879
commonDevShell = {
7980
packages = [ rustToolchain ] ++ commonDevShellPackages;

0 commit comments

Comments
 (0)