liveBook · Manning

GitHub Actions

As explained in gRPC Microservices in Go

GitHub Actions is a GitHub automation platform for running workflows in response to repository and software-development events.

GitHub Actions runs repository workflows for building, testing, and deployment. In a Go gRPC microservice system, it can take repetitive Protocol Buffer generation and release work out of the manual development cycle. Workflow files live in `.github/workflows`. section 3.3.2 section 1.4

A tag-driven workflow can publish Go code generated from service `.proto` files:

  • Push a release tag to trigger the workflow. section 3.3.2
  • Run a job for each service using a matrix strategy; install the required Go and Protocol Buffer tools, then call the generation script. section 3.3.2
  • Generate Go source, initialize each service’s Go module, push the changes, and create service-specific tags for clients to consume. section 3.3.2 section 3.3.1

Separate module tags let a client request the latest package or pin a specific version. Pinning is the safer choice when a newer tag might contain incompatible changes. Automation becomes more valuable as the number of services—and the manual generation and tagging work—grows. section 3.3.1

name: "Protocol Buffer Go Stubs Generation"
on:
  push:
    tags:
      - v**                                                                #1
jobs:
  protoc:
    name: "Generate"
    runs-on: ubuntu-latest
    strategy:
      matrix:
        service: ["order", "payment", "shipping"]                          #2
    steps:
      - name: Install Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.17
      - uses: actions/checkout@v2
      - name: Etract Release Version
        run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV   #3
      - name: "Generate for Golang"
        shell: bash
        run: |
          chmod +x "${GITHUB_WORKSPACE}/run.sh"                            #4
          ./run.sh ${{ matrix.service }} ${{ env.RELEASE_VERSION }}        #5

The workflow listing shows the tag trigger, the order/payment/shipping job matrix, and the release version passed to the generation script. section 3.3.2

How gRPC Microservices in Go covers it

How deep it goes
Shows a tag-triggered workflow, service matrix, and generation script; does not demonstrate a full deployment pipeline.
Examples
Uses order, payment, and shipping services to demonstrate a matrix job that generates Go code from `.proto` files.
What it assumes
Assumes familiarity with Go modules, `.proto` files, and Git tags, but does not require GitHub Actions expertise.
What you can do after
Operate/configure it to trigger per-service Go source generation and tagging when release tags are pushed.
How it connects
Connects Protocol Buffers, gRPC, Go modules, Git tags, and CI/CD.

Also explained in

Compare how 10 books explain GitHub Actions →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of gRPC Microservices in Go. The section links point to the parts of the book it draws on.