Skip to content

Commit

Permalink
Fix the workflows so that we can auto release a new major version (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
ido-namely authored Sep 13, 2022
1 parent f16a44d commit 2b014d9
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build, Tag & Push a new release to dockerhub off of a tag
# Build, Tag & Push a new prerelease to dockerhub off of a tag

name: Pre-release
name: Docker Pre-release

on:
push:
Expand All @@ -9,7 +9,7 @@ on:


jobs:
prerelease-build:
docker_prerelease:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/docker_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Build, Tag & Push a new release to dockerhub off of a new pushed tag or gh_grpc_release.yml workflow

name: Docker Release

on:
workflow_call:
inputs:
release_version:
required: true
type: string
push:
tags:
- 'v[0-9]+.[0-9]+_[0-9]+'


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

- uses: nelonoel/[email protected]

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

- name: Get Version
id: get_version
run: |
version=""
if [[ ${{ github.event_name }} == "pull_request" ]]; then
version=${{ inputs.release_version }}
fi
if [[ ${{ github.event_name }} == "push" ]]; then
version=${GITHUB_REF#refs/*/}
fi
# Strip "v" prefix from tag name and set to output var
echo ::set-output name=version::${version#v}
- name: Build and Tag
if: success()
env:
VERSION: ${{ steps.get_version.outputs.version }}
run: make tag-latest

- name: Push
if: success()
env:
VERSION: ${{ steps.get_version.outputs.version }}
run: make push-latest
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Note that once a new release is created in GH, a separate workflow will take care of releasing new docker images to dockerhub accordingly.

name: New gPRC Release
name: Github gRPC Release

on:
pull_request:
Expand All @@ -19,9 +19,11 @@ on:
- 'master'

jobs:
new_release:
new_gh_release:
if: github.event.pull_request.merged == true && github.head_ref == 'renovate/grpc-major-upgrade'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_version_as_output.outputs.version }}
steps:
# checkout the repo
- uses: actions/checkout@v3
Expand All @@ -35,10 +37,20 @@ jobs:
VER=$(pcregrep -o1 "^GRPC_VERSION=\\$\{GRPC_VERSION:-(.*?)\\}$" variables.sh)
# This makes the value accessible from env.Version
echo "VERSION=v${VER}_0" >> $GITHUB_ENV
- name: Set version value as output
id: set_version_as_output
run:
echo ::set-output name=version::${{ env.VERSION }}
- name: Create new release
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
gh release create ${{ env.VERSION }} --generate-notes --repo $GITHUB_REPOSITORY
new_docker_release:
needs: new_gh_release
uses: ./.github/workflows/docker_release.yml
with:
release_version: ${{ needs.new_gh_release.outputs.version }}
secrets: inherit

49 changes: 0 additions & 49 deletions .github/workflows/release.yml

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,9 @@ Please read more [here](./.github/renovate.md).

### Release

Any new gRPC version based release is handled automatically once the relevant [Renovate](https://www.mend.io/free-developer-tools/renovate/) branch is merged to master
via the CI (Github Action). A patch release should be created manually in Github and the CI workflow will take care of the rest.
* A new gRPC version based release is handled automatically once the relevant [Renovate](https://www.mend.io/free-developer-tools/renovate/) branch is merged to master
via the CI (Github Action).
* A patch/release candidate release should be created manually in Github and the CI workflow will take care of the rest.

#### Contributors

Expand Down

0 comments on commit 2b014d9

Please sign in to comment.