name: Verify Build

on:
  pull_request:
  push:
    branches:
      - asciidoc

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    # Step 0: Install build requirements
    - name: Install Build Requirements
      run: sudo apt-get install -y python3-sympy

    # Step 1: Checkout the repository
    - name: Checkout repository
      uses: actions/checkout@v3
      with:
        submodules: 'recursive'

    # Step 2: Pull the latest RISC-V Docs container image
    - name: Pull Container
      run: docker pull riscvintl/riscv-docs-base-container-image:latest

    # Step 3: Build Files
    - name: Build Files
      run: cd ./build && make

    # Step 4: Upload the built PDF files as a single artifact
    - name: Upload Build Artifacts
      uses: actions/upload-artifact@v3
      with:
        name: Build Artifacts
        path: ${{ github.workspace }}/build/*.pdf
        retention-days: 30
