1
0

action.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. name: "Install exe"
  2. description: "Download and install exe"
  3. inputs:
  4. url:
  5. description: "URL of the exe installer"
  6. required: true
  7. args:
  8. description: "Installer arguments"
  9. required: true
  10. timeout:
  11. description: "Timeout (in ms)"
  12. required: false
  13. default: "600000"
  14. runs:
  15. using: "composite"
  16. steps:
  17. - name: Install EXE
  18. shell: pwsh
  19. run: |
  20. $ErrorActionPreference = "Stop"
  21. write-host "Downloading Installer EXE"
  22. Invoke-WebRequest -Uri "${{ inputs.url }}" -OutFile "${env:RUNNER_TEMP}\temp-install.exe"
  23. write-host "Installing"
  24. $proc = Start-Process "${env:RUNNER_TEMP}\temp-install.exe" -ArgumentList '${{ inputs.args }}' -NoNewWindow -PassThru
  25. $completed = $proc.WaitForExit(${{ inputs.timeout }})
  26. if (-not $completed) {
  27. Write-Error "Installer timed out. Killing the process"
  28. $proc.Kill()
  29. exit 1
  30. }
  31. if ($proc.ExitCode -ne 0) {
  32. Write-Error "Installer failed with exit code $($proc.ExitCode)"
  33. exit 1
  34. }
  35. write-host "Completed installation"