Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

# build the image on master

name: Master

on:
push:
branches:
- master
paths-ignore:
- 'README.md'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true

- uses: nelonoel/branch-name@v1.0.1

- name: Docker Login
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: docker login --username "$DOCKERHUB_USERNAME" --password "$DOCKERHUB_TOKEN"

- name: Create Short Commit Sha
id: sha_short
if: success()
run: echo ::set-output name=SHA_SHORT::$(git rev-parse --short HEAD)

- name: Build
if: success()
env:
BUILD_VERSION: ${{ steps.sha_short.outputs.SHA_SHORT }}
run: make build
15 changes: 8 additions & 7 deletions .github/workflows/pr_master.yml → .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@

# build the image on PRs and master
# build the image on PRs

name: PR

on:
pull_request:
push:
branches:
- master
paths-ignore:
- 'README.md'

jobs:
build:
runs-on: ubuntu-latest
env:
COMMIT_HASH: ${{ github.sha }}
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -29,7 +24,13 @@ jobs:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: docker login --username "$DOCKERHUB_USERNAME" --password "$DOCKERHUB_TOKEN"

- name: Create Short Commit Sha
id: sha_short
if: success()
run: echo ::set-output name=SHA_SHORT::$(git rev-parse --short HEAD)

- name: Build
if: success()
env:
BUILD_VERSION: ${{ env.COMMIT_HASH }}
BUILD_VERSION: ${{ steps.sha_short.outputs.SHA_SHORT }}
run: make build
49 changes: 49 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Build, Tag & Push a new release to dockerhub off of a tag

name: Pre-release

on:
push:
tags:
- 'v[0-9]+.[0-9]+_[0-9]+-rc.[0-9]+"'


jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true

- uses: nelonoel/branch-name@v1.0.1

- name: Docker Login
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: docker login --username "$DOCKERHUB_USERNAME" --password "$DOCKERHUB_TOKEN"

- name: Create Version
id: version
if: success()
run: |
# TODO: find a better way to version from tags
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# set to output var
echo ::set-output name=VERSION::${VERSION}

- name: Build and Tag
if: success()
env:
VERSION: ${{ steps.version.outputs.VERSION }}
run: make tag

- name: Push
if: success()
env:
VERSION: ${{ steps.version.outputs.VERSION }}
run: make push
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Release
on:
push:
tags:
- 'v*'
- 'v[0-9]+.[0-9]+_[0-9]+"'


jobs:
Expand All @@ -26,6 +26,7 @@ jobs:

- name: Create Version
id: version
if: success()
run: |
# TODO: find a better way to version from tags
# Strip git ref prefix from version
Expand All @@ -36,12 +37,13 @@ jobs:
echo ::set-output name=VERSION::${VERSION}

- name: Build and Tag
if: success()
env:
BUILD_VERSION: ${{ steps.version.outputs.VERSION }}
VERSION: ${{ steps.version.outputs.VERSION }}
run: make tag-latest

- name: Push
if: success()
env:
BUILD_VERSION: ${{ steps.version.outputs.VERSION }}
VERSION: ${{ steps.version.outputs.VERSION }}
run: make push-latest
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# gRPC/Protocol Buffer Compiler Containers

[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/namely/docker-protoc/Build/master?style=flat-square)](https://github.com/namely/docker-protoc/actions?query=workflow%3ABuild)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/namely/docker-protoc/Build/master?style=flat-square)](https://github.com/namely/docker-protoc/actions?query=workflow%3AMaster)

This repository contains support for various Docker images that wrap `protoc`,
`prototool`, `grpc_cli` commands with [gRPC](https://github.com/grpc/grpc) support
Expand Down Expand Up @@ -288,7 +288,9 @@ Thank you!!
Namely employees can merge PRs and cut a release/pre-release by drafting a new Github release and publishing them.
The release name should follow the same tag conventions described in [this doc](#tag-conventions) and the gRPC version in the release name
must match the `GRPC_VERSION` configured in [variables.sh](./variables.sh).
Once a new Github release is published, new images will be published to [DockerHub](https://hub.docker.com/u/namely/) via CI.
A valid release/pre-release will be of the form `v${GRPC_VERSION}_${BUILD_VERSION}`/`v${GRPC_VERSION}_${BUILD_VERSION}-rc.${RC_VERSION}` respectively.
e.g `1.37_2`, `1.38_0-rc.3`.
Once a new **valid** Github release is published, new images will be published to [DockerHub](https://hub.docker.com/u/namely/) via CI.

## Docker Troubleshooting

Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source ./variables.sh

for build in ${BUILDS[@]}; do
tag=${CONTAINER}/${build}:${BUILD_VERSION}
tag=${CONTAINER}/${build}:${VERSION}
echo "building ${build} container with tag ${tag}"
docker build -t ${tag} \
-f Dockerfile \
Expand Down
2 changes: 1 addition & 1 deletion push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source ./variables.sh

for build in ${BUILDS[@]}; do
tag=${CONTAINER}/${build}:${BUILD_VERSION}
tag=${CONTAINER}/${build}:${VERSION}
echo "pushing ${tag}"
docker push ${tag}

Expand Down
3 changes: 2 additions & 1 deletion variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ NODE_VERSION=${NODE_VERSION:-14}
NODE_GRPC_TOOLS_NODE_PROTOC_TS_VERSION=${NODE_GRPC_TOOLS_NODE_PROTOC_TS_VERSION:-5.1.3}
NODE_GRPC_TOOLS_VERSION=${NODE_GRPC_TOOLS_VERSION:-1.11.1}
NODE_PROTOC_GET_GRPC_WEB_VERSION=${NODE_PROTOC_GET_GRPC_WEB_VERSION:-1.2.1}
BUILD_VERSION="${BUILD_VERSION:-${GRPC_VERSION}_0}"
BUILD_VERSION="${BUILD_VERSION:-local}"
VERSION="${VERSION:-${GRPC_VERSION}_${BUILD_VERSION}}"