This repository has been archived by the owner on Feb 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
54 lines (50 loc) · 1.9 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
52
53
54
name: 'Archive and upload Build Artifacts'
description: 'Archive build artifacts and upload them so that they can be used by subsequent workflow steps.'
author: Rainer Schlönvoigt
branding:
icon: 'arrow-up'
color: 'green'
inputs:
name:
description: 'Artifact name'
default: 'artifact'
directory:
description: 'The base directory '
default: '.'
path:
description: 'A file, directory or wildcard pattern that describes what to upload. These must be relative to the `directory` input parameter.'
required: true
retention-days:
description: >
Duration after which artifact will expire in days. 0 means using default retention.
Minimum 1 day.
Maximum 90 days unless changed from the repository settings page.
runs:
using: composite
steps:
- id: generate-name
run: |
# It is possible to call this action multiple times.
# Ideally we want to store the files from all the calls, not overwrite them.
# Therefore, the archive can't have a fixed name.
RANDOM_ELEMENT=$(dd bs=512 if=/dev/urandom count=1 2>/dev/null | env LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
ZIP_NAME="${RANDOM_ELEMENT}.rTmpArchive.zip"
echo "zip_name=$ZIP_NAME" >> $GITHUB_OUTPUT
shell: bash
- name: Archive Build Artifacts
uses: TheDoctor0/[email protected]
with:
filename: ${{ steps.generate-name.outputs.zip_name }}
directory: ${{ inputs.directory }}
path: ${{ inputs.path }}
- name: Upload Archive
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.name }}
retention-days: ${{ inputs.retention-days }}
path: ${{ inputs.directory }}/${{ steps.generate-name.outputs.zip_name }}
if-no-files-found: error
- name: Clean up
if: always()
run: rm ${{ inputs.directory }}/${{ steps.generate-name.outputs.zip_name }}
shell: bash