-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
51 lines (43 loc) · 1.66 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: 'Download and untar an artifact, preserving permissions'
description: 'Download a build artifact that was previously uploaded in the workflow by the gha-upload-tar-artifact action, with permissions preserved.'
author: 'The Browser Company of New York'
inputs:
name:
description: 'The name of the artifact to download.'
default: 'artifact'
required: true
path:
description: 'Destination path. Defaults to $GITHUB_WORKSPACE.'
default: ${{ github.workspace }}
outputs:
download-path:
description: 'Path of artifact download'
runs:
using: composite
steps:
- name: Create Temporary Directory
shell: pwsh
id: create-temp-dir
run: |
$TempDir = New-TemporaryFile | % { Remove-Item $_; New-Item -ItemType Directory -Path $_ }
echo "temp-dir=$TempDir" >> $env:GITHUB_OUTPUT
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.name }}
path: ${{ steps.create-temp-dir.outputs.temp-dir }}
- name: Extract Tar Archive
shell: pwsh
id: extract-tar
run: |
New-Item -ItemType Directory -Path "${{ inputs.path }}" -Force | Out-Null
$TarFile = Join-Path "${{ steps.create-temp-dir.outputs.temp-dir }}" "${{ inputs.name }}.tar"
$tar = if ($IsWindows) { "${env:WINDIR}\System32\tar.exe" } else { "tar" }
& $tar xf $TarFile -C ${{ inputs.path }}
- name: Delete Temporary Directory
shell: pwsh
run: Remove-Item -Recurse ${{ steps.create-temp-dir.outputs.temp-dir }}
- name: Export Output
shell: pwsh
run: |
Write-Output "download-path=${{ inputs.path }}" >> $env:GITHUB_OUTPUT