Skip to content

Commit f3171fa

Browse files
Add CI elf files auto find
1 parent 1540e0e commit f3171fa

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/build-artifacts.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,20 @@ jobs:
5353
uses: actions/attest-build-provenance@v1
5454
with:
5555
subject-path: '"workspace/*.dll","workspace/*.exe"'
56+
57+
- name: Find ELF files - MacOS and Linux
58+
if: runner.os != 'Windows' && github.event_name != 'pull_request'
59+
id: find-elf-files
60+
working-directory: ${{github.workspace}}
61+
run: |
62+
ELF_FILES=$(./CIUtils/find-executable.sh "workspace/")
63+
echo "::set-output name=elf_files::$ELF_FILES"
5664
5765
- name: Generate artifact attestation - MacOS and Linux
5866
if: runner.os != 'Windows' && github.event_name != 'pull_request'
5967
uses: actions/attest-build-provenance@v1
6068
with:
61-
subject-path: '"workspace/*.dll","workspace/ExtensionInstaller","workspace/TuneLab"'
69+
subject-path: '"workspace/*.dll",${{ steps.find-elf-files.outputs.elf_files }}'
6270

6371
- name: Get short SHA
6472
uses: benjlevesque/[email protected]

CIUtils/find-executable.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# Check if a directory is provided as an argument
4+
if [ -z "$1" ]; then
5+
echo "Usage: $0 <directory>"
6+
exit 1
7+
fi
8+
9+
# Directory to search
10+
directory=$1
11+
12+
# Find ELF files in the specified directory
13+
files=$(find "$directory" -type f -exec sh -c 'file -b "$1" | grep -q "ELF" && echo "$1"' _ {} \;)
14+
15+
# Initialize an empty string for the output
16+
output=""
17+
18+
# Loop through each file and format it
19+
for file in $files; do
20+
if [ -z "$output" ]; then
21+
output="\"$file\""
22+
else
23+
output="$output,\"$file\""
24+
fi
25+
done
26+
27+
# Print the formatted output
28+
echo $output

0 commit comments

Comments
 (0)