name: Reproducible build

on:
  workflow_dispatch:

permissions:
  contents: read
  id-token: write
  attestations: write

jobs:
  build:
    strategy:
      matrix:
        os: [macos-latest, ubuntu-latest, windows-latest]
    runs-on: ${{ matrix.os }}

    steps:
    - uses: ilammy/msvc-dev-cmd@v1
    - uses: actions/checkout@v4
    - uses: actions/setup-go@v5
      with: { go-version: stable }

    - name: Build
      shell: bash
      run: .github/workflows/repro.sh

    - uses: actions/attest-build-provenance@v1
      if: matrix.os == 'ubuntu-latest'
      with:
        subject-path: |
          embed/sqlite3.wasm
          embed/bcw2/bcw2.wasm
          util/sql3util/parse/sql3parse_table.wasm