name: Install Docgen
description: |
  Install Docgen
runs:
  using: "composite"
  steps:
    - name: Checkout talos
      uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
      with:
        fetch-depth: 0
        repository: "siderolabs/talos"
        ref: "v1.2.6"
        path: talos

    # This is required to be able to build docgen
    - name: Remove go.work
      shell: bash
      working-directory: talos
      run: rm go.work*

    - name: Install Docgen
      shell: bash
      working-directory: talos/hack/docgen
      run: |
        go build -o docgen .
        mv docgen /usr/local/bin
