name: Validate release builds

on:
  push:
    tags: ['v*']
  workflow_dispatch:

permissions:
  contents: read  #  to fetch code (actions/checkout)

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Read go.version
        run: |
          echo "GO_VERSION=$(cat go.version)" >> $GITHUB_ENV

      - name: Set up Go ${{ env.GO_VERSION }}
        uses: actions/setup-go@v3
        with:
          go-version: ${{ env.GO_VERSION }}
        id: go

      - name: Validation checks
        run: |
          make validate-builds
