Skip to content

Commit

Permalink
Add protobuf and grpc runtime versions to buf plugins (#2702)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbrandhorst committed May 23, 2022
1 parent 635bbea commit 9ad76c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/plugins/protoc-gen-grpc-gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ RUN go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway

FROM scratch

ARG RELEASE_VERSION
ARG GO_PROTOBUF_RELEASE_VERSION
ARG GO_GRPC_RELEASE_VERSION

# Runtime dependencies
LABEL "build.buf.plugins.runtime_library_versions.0.name"="github.com/grpc-ecosystem/grpc-gateway"
LABEL "build.buf.plugins.runtime_library_versions.0.version"="${RELEASE_VERSION}"
LABEL "build.buf.plugins.runtime_library_versions.1.name"="google.golang.org/protobuf"
LABEL "build.buf.plugins.runtime_library_versions.1.version"="${GO_PROTOBUF_RELEASE_VERSION}"
LABEL "build.buf.plugins.runtime_library_versions.2.name"="google.golang.org/grpc"
LABEL "build.buf.plugins.runtime_library_versions.2.version"="${GO_GRPC_RELEASE_VERSION}"

COPY --from=builder /go/bin/protoc-gen-grpc-gateway /usr/local/bin/protoc-gen-grpc-gateway

ENTRYPOINT ["/usr/local/bin/protoc-gen-grpc-gateway"]
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ jobs:
registry: plugins.buf.build
username: grpcgatewaybot
password: ${{ secrets.BUF_TOKEN }}
- name: Set protobuf-version
run: echo ::set-output name=version::$(go list -m -f '{{.Version}}' google.golang.org/protobuf)
id: protobuf-version
- name: Set grpc-version
run: echo ::set-output name=version::$(go list -m -f '{{.Version}}' google.golang.org/grpc)
id: grpc-version
- uses: docker/build-push-action@v3
with:
push: true
Expand All @@ -40,6 +46,8 @@ jobs:
platforms: linux/amd64
build-args: |
RELEASE_VERSION=${{ github.ref_name }}
GO_PROTOBUF_RELEASE_VERSION=${{ steps.protobuf-version.outputs.version }}
GO_GRPC_RELEASE_VERSION=${{ steps.grpc-version.outputs.version }}
- uses: docker/build-push-action@v3
with:
push: true
Expand Down

0 comments on commit 9ad76c7

Please sign in to comment.