forked from stacks-network/actions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
54 lines (48 loc) · 1.57 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
## Github workflow to generate a sha512 checksum for the build archive
name: Generate Checksum
inputs:
hashfile_name:
description: "The name of the generated checksum file"
required: false
default: "CHECKSUMS.txt"
artifact_download_pattern:
description: "The pattern of artifacts to download. Defaults to '*' (all artifacts)"
required: false
default: "*"
runs:
using: "composite"
steps:
## Downloads the artifacts built in `create-source-binary.yml`
- name: Download Artifacts
id: download_artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
pattern: ${{ inputs.artifact_download_pattern }}
path: release
merge-multiple: true
## Generate a checksums file to be added to the release page
- name: Generate Checksums
id: generate_checksum
shell: bash
run: |
# If sha512sum command doesn't exist on the host, exit
if ! command -v sha512sum > /dev/null 2>&1; then
echo "sha512sum command doesn't exist!";
exit 1;
fi
# Generate the hashes and exit if the variable is empty
if [ -d release ]; then
cd release
else
echo "Artifact directory does not exist!"
exit 1;
fi
shasum="$(sha512sum *)"
if [[ -z "$shasum" ]]; then
echo "Checksum could not be generated!";
exit 1;
fi
echo "Generated checksums:"
echo "$shasum"
echo "$shasum" > "../${{ inputs.hashfile_name }}";
exit 0;