diff --git a/.github/workflows/build-artifacts.yml b/.github/workflows/build-artifacts.yml index 729d61b..3bfcd4a 100644 --- a/.github/workflows/build-artifacts.yml +++ b/.github/workflows/build-artifacts.yml @@ -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/short-sha@v3.0 diff --git a/.github/workflows/upload-release.yml b/.github/workflows/upload-release.yml index de06f9e..66fce7e 100644 --- a/.github/workflows/upload-release.yml +++ b/.github/workflows/upload-release.yml @@ -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 ./* diff --git a/CIUtils/find-executable.sh b/CIUtils/find-executable.sh new file mode 100644 index 0000000..9871c95 --- /dev/null +++ b/CIUtils/find-executable.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Check if a directory is provided as an argument +if [ -z "$1" ]; then + echo "Usage: $0 " + 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