google.golang.org/grpc@v1.62.1/.github/workflows/release.yml (about)

     1  name: Release
     2  
     3  on:
     4    release:
     5      types: [published]
     6  
     7  permissions:
     8    contents: read
     9  
    10  jobs:
    11    release:
    12      permissions:
    13        contents: write # to upload release asset (actions/upload-release-asset)
    14  
    15      name: Release cmd/protoc-gen-go-grpc
    16      runs-on: ubuntu-latest
    17      if: startsWith(github.event.release.tag_name, 'cmd/protoc-gen-go-grpc/')
    18      strategy:
    19        matrix:
    20          goos: [linux, darwin, windows]
    21          goarch: [386, amd64, arm64]
    22          exclude:
    23            - goos: darwin
    24              goarch: 386
    25  
    26      steps:
    27        - name: Checkout code
    28          uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
    29  
    30        - name: Set up Go
    31          uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
    32  
    33        - name: Download dependencies
    34          run: |
    35            cd cmd/protoc-gen-go-grpc
    36            go mod download
    37  
    38        - name: Prepare build directory
    39          run: |
    40            mkdir -p build/
    41            cp README.md build/
    42            cp LICENSE build/
    43  
    44        - name: Build
    45          env:
    46            GOOS: ${{ matrix.goos }}
    47            GOARCH: ${{ matrix.goarch }}
    48          run: |
    49            cd cmd/protoc-gen-go-grpc
    50            go build -trimpath -o $GITHUB_WORKSPACE/build
    51  
    52        - name: Create package
    53          id: package
    54          run: |
    55            PACKAGE_NAME=protoc-gen-go-grpc.${GITHUB_REF#refs/tags/cmd/protoc-gen-go-grpc/}.${{ matrix.goos }}.${{ matrix.goarch }}.tar.gz
    56            tar -czvf $PACKAGE_NAME -C build .
    57            echo "name=${PACKAGE_NAME}" >> $GITHUB_OUTPUT
    58  
    59        - name: Upload asset
    60          uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
    61          env:
    62            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    63          with:
    64            upload_url: ${{ github.event.release.upload_url }}
    65            asset_path: ./${{ steps.package.outputs.name }}
    66            asset_name: ${{ steps.package.outputs.name }}
    67            asset_content_type: application/gzip