name: Build

inputs:
  app_name:
    description: The name of the app directory
    required: true

runs:
  using: "composite"
  steps:
    - uses: actions/checkout@v4
      with:
        submodules: recursive
    - name: 'Build'
      uses: espressif/esp-idf-ci-action@v1
      with:
        esp_idf_version: v5.5
        path: .
        # The export reset prevents an error when building other targets
        # The default environment variable is set to "esp32" by the GitHub Action
        command: 'export IDF_TARGET= && python tactility.py Apps/${{ inputs.app_name }} build'
    - name: 'Upload Artifact'
      uses: actions/upload-artifact@v4
      with:
        name: ${{ inputs.app_name }}
        path: Apps/${{ inputs.app_name}}/build/${{ inputs.app_name }}.app
        retention-days: 30

