Skip to content

Commit

Permalink
Add CI elf files auto find
Browse files Browse the repository at this point in the history
  • Loading branch information
FangCunWuChang committed Jul 31, 2024
1 parent 1540e0e commit f3171fa
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,20 @@ jobs:
uses: actions/attest-build-provenance@v1
with:
subject-path: '"workspace/*.dll","workspace/*.exe"'

- name: Find ELF files - MacOS and Linux
if: runner.os != 'Windows' && github.event_name != 'pull_request'
id: find-elf-files
working-directory: ${{github.workspace}}
run: |
ELF_FILES=$(./CIUtils/find-executable.sh "workspace/")
echo "::set-output name=elf_files::$ELF_FILES"
- name: Generate artifact attestation - MacOS and Linux
if: runner.os != 'Windows' && github.event_name != 'pull_request'
uses: actions/attest-build-provenance@v1
with:
subject-path: '"workspace/*.dll","workspace/ExtensionInstaller","workspace/TuneLab"'
subject-path: '"workspace/*.dll",${{ steps.find-elf-files.outputs.elf_files }}'

- name: Get short SHA
uses: benjlevesque/[email protected]
Expand Down
28 changes: 28 additions & 0 deletions CIUtils/find-executable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Check if a directory is provided as an argument
if [ -z "$1" ]; then
echo "Usage: $0 <directory>"
exit 1
fi

# Directory to search
directory=$1

# Find ELF files in the specified directory
files=$(find "$directory" -type f -exec sh -c 'file -b "$1" | grep -q "ELF" && echo "$1"' _ {} \;)

# Initialize an empty string for the output
output=""

# Loop through each file and format it
for file in $files; do
if [ -z "$output" ]; then
output="\"$file\""
else
output="$output,\"$file\""
fi
done

# Print the formatted output
echo $output

0 comments on commit f3171fa

Please sign in to comment.