# This aciton will only work on Windows runners

name: 'Use Custom AnyBodyCon from Azure Blob storage'

description: 'Download specific anybodycon version from Azure Blob storage'

inputs:
  custom-anybodycon:  # path
    description: 'The AnyBodyCon version to use'
    required: true
  connection-string:
    description: 'The connection string to the Azure Blob storage'
    required: true
  target-path:
    description: 'Where to place the custom AnyBodyCon version.'
    required: true


runs:
  using: "composite"
  steps: 
    - name: Create temp location for AnyBodyCon
      if: ${{ inputs.custom-anybodycon }}
      shell: powershell
      run: mkdir -p ${{ runner.temp }}/$(split-path ${{ inputs.custom-anybodycon }} -Parent)
      
    - name: Get special AnyBodyCon version
      if: ${{ inputs.custom-anybodycon }}
      uses: armanrahman22/azblob-download-action@main
      with:
        connection-string: ${{ inputs.connection-string }}
        container-name: "anybodycon"
        blob-name: ${{ inputs.custom-anybodycon }}
        download-path: ${{ runner.temp }}
      
    - name: Update AnyBodyCon version
      shell: powershell
      run: |
        cp ${{ runner.temp }}\${{ inputs.custom-anybodycon }} "${{ inputs.target-path }}"
