name: Publish Firmware

inputs:
  cdn_version:
    description: The version that determines the path on the CDN
    required: true

runs:
  using: 'composite'
  steps:
    - name: 'Download all-firmwares'
      uses: actions/download-artifact@v4
      with:
        name: 'all-firmwares'
        path: firmwares
    - name: 'Install boto3'
      shell: bash
      run: pip install boto3
    - name: 'Generate files'
      shell: bash
      run: version=`cat version.txt` && python Buildscripts/CDN/generate-files.py firmwares firmwares-cdn $version
    - name: 'Upload files'
      shell: bash
      run: python Buildscripts/CDN/upload-files.py firmwares-cdn ${{ inputs.cdn_version }} ${{ env.CDN_ID }} ${{ env.CDN_TOKEN_NAME }} ${{ env.CDN_TOKEN_VALUE }}