name: Release

# Validates the tagged code when a release is published (build + test).
# For a Go library a "release" is simply a git tag consumers depend on, so this
# workflow guards that a released tag builds and passes its tests rather than
# publishing a container image.

on:
  release:
    types: [published]
  workflow_dispatch:

permissions:
  contents: read

jobs:
  validate:
    name: Validate release (Go)
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: '1.24'
          check-latest: true
          cache-dependency-path: go.sum

      - name: Build
        run: go build -v ./...

      - name: Test
        # See pr-build.yml: the ws-discovery probe test needs real cameras.
        run: go test $(go list ./... | grep -v '/ws-discovery')
