64 lines
2.4 KiB
YAML
64 lines
2.4 KiB
YAML
name: Upload CI artifact with bounded retries
|
|
description: Save an artifact with at most three attempts, replacing incomplete uploads of the same name.
|
|
inputs:
|
|
name:
|
|
description: Artifact name, unique to this job in the workflow run
|
|
required: true
|
|
path:
|
|
description: Files and directories to upload
|
|
required: true
|
|
compression-level:
|
|
description: ZIP compression level
|
|
default: '0'
|
|
retention-days:
|
|
description: Artifact retention in days
|
|
default: '30'
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Upload artifact (attempt 1 of 3)
|
|
id: first
|
|
continue-on-error: true
|
|
uses: https://github.com/actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
|
with:
|
|
name: ${{ inputs.name }}
|
|
path: ${{ inputs.path }}
|
|
compression-level: ${{ inputs.compression-level }}
|
|
retention-days: ${{ inputs.retention-days }}
|
|
if-no-files-found: error
|
|
include-hidden-files: true
|
|
overwrite: true
|
|
- name: Wait before second upload attempt
|
|
if: ${{ !cancelled() && steps.first.outcome == 'failure' }}
|
|
shell: pwsh
|
|
run: Start-Sleep -Seconds 5
|
|
- name: Upload artifact (attempt 2 of 3)
|
|
id: second
|
|
if: ${{ !cancelled() && steps.first.outcome == 'failure' }}
|
|
continue-on-error: true
|
|
uses: https://github.com/actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
|
with:
|
|
name: ${{ inputs.name }}
|
|
path: ${{ inputs.path }}
|
|
compression-level: ${{ inputs.compression-level }}
|
|
retention-days: ${{ inputs.retention-days }}
|
|
if-no-files-found: error
|
|
include-hidden-files: true
|
|
overwrite: true
|
|
- name: Wait before final upload attempt
|
|
if: ${{ !cancelled() && steps.first.outcome == 'failure' && steps.second.outcome == 'failure' }}
|
|
shell: pwsh
|
|
run: Start-Sleep -Seconds 15
|
|
- name: Upload artifact (attempt 3 of 3)
|
|
id: third
|
|
if: ${{ !cancelled() && steps.first.outcome == 'failure' && steps.second.outcome == 'failure' }}
|
|
uses: https://github.com/actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
|
with:
|
|
name: ${{ inputs.name }}
|
|
path: ${{ inputs.path }}
|
|
compression-level: ${{ inputs.compression-level }}
|
|
retention-days: ${{ inputs.retention-days }}
|
|
if-no-files-found: error
|
|
include-hidden-files: true
|
|
overwrite: true
|