Skip to content

Commit

Permalink
Merge pull request #77 from Do-sth-sharp/master
Browse files Browse the repository at this point in the history
[CI]: Add binary files auto glob on Linux and Mac OS platforms
  • Loading branch information
LiuYunPlayer authored Jul 31, 2024
2 parents 02676be + 0aec069 commit a143bb3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,32 @@ jobs:
- name: Build the application
run: dotnet publish --configuration Release -r ${{ matrix.runtime }}

- name: Move artifacts - Windows
if: runner.os == 'Windows'
- name: Move artifacts
shell: pwsh
run: Move-Item -Path TuneLab\bin\Release\net8.0\${{ matrix.runtime }}\publish -Destination workspace

- name: Move artifacts - MacOS and Linux
if: runner.os != 'Windows'
run: mv TuneLab/bin/Release/net8.0/${{ matrix.runtime }}/publish workspace

- name: Generate artifact attestation - Windows
if: runner.os == 'Windows' && github.event_name != 'pull_request'
uses: actions/attest-build-provenance@v1
with:
subject-path: '"workspace/*.dll","workspace/*.exe"'

- name: Find executable and dynamic library files - MacOS and Linux
if: runner.os != 'Windows' && github.event_name != 'pull_request'
id: find-executable-files
shell: bash
working-directory: ${{github.workspace}}
run: |
find ./CIUtils/ -name "*.sh" -exec chmod +x {} \;
EXEC_FILES=$(./CIUtils/find-executable.sh "workspace/")
echo "Found executable and dynamic library files: $EXEC_FILES"
echo "exec_files=$EXEC_FILES" >> $GITHUB_OUTPUT
- 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-executable-files.outputs.exec_files }}'

- name: Get short SHA
uses: benjlevesque/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/upload-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:

- name: Package - MacOS and Linux
if: runner.os != 'Windows'
shell: bash
working-directory: ${{github.workspace}}
run: tar -zcvf package.tar.gz ./*

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, Mach-O and Universal Binary files in the specified directory
files=$(find "$directory" -type f -exec sh -c 'file -b "$1" | grep -qE "ELF|Mach-O|universal binary" && echo "$1" | sed "s:/\{1,\}:/:g"' _ {} \;)

# 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 a143bb3

Please sign in to comment.