From d0bab9eb08e73fdf705e9e809df81a690ffa4068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Wei=C3=9Fe?= <66256922+daniel-weisse@users.noreply.github.com> Date: Thu, 23 May 2024 09:24:15 +0200 Subject: [PATCH] ci: ignore missing files when creating archive (#3118) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Reduce output noise from using 7zip * Ignore non existent files when creating archive --------- Signed-off-by: Daniel Weiße --- .github/actions/artifact_download/action.yml | 2 +- .github/actions/artifact_upload/action.yml | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/actions/artifact_download/action.yml b/.github/actions/artifact_download/action.yml index 7bef0caa5..67f772fea 100644 --- a/.github/actions/artifact_download/action.yml +++ b/.github/actions/artifact_download/action.yml @@ -37,4 +37,4 @@ runs: shell: bash run: | mkdir -p ${{ inputs.path }} - 7zz x -p'${{ inputs.encryptionSecret }}' -t7z -o"${{ inputs.path }}" ${{ steps.tempdir.outputs.directory }}/archive.7z + 7zz x -p'${{ inputs.encryptionSecret }}' -bso0 -bsp0 -t7z -o"${{ inputs.path }}" ${{ steps.tempdir.outputs.directory }}/archive.7z diff --git a/.github/actions/artifact_upload/action.yml b/.github/actions/artifact_upload/action.yml index ec2d4d85b..14f5df055 100644 --- a/.github/actions/artifact_upload/action.yml +++ b/.github/actions/artifact_upload/action.yml @@ -47,6 +47,7 @@ runs: something_exists=true fi done + # Create an archive if files exist. # Don't create an archive file if no files are found # and warn. @@ -55,11 +56,15 @@ runs: echo "::warning:: No files/directories found with the provided path(s): ${paths}. No artifact will be uploaded." exit 0 fi + for target in ${paths} do - pushd "$(dirname "${target}")" || exit 1 - 7zz a -p'${{ inputs.encryptionSecret }}' -t7z -ms=on -mhe=on "${{ steps.tempdir.outputs.directory }}/archive.7z" "$(basename "${target}")" - popd || exit 1 + if [[ -f "${target}" ]] + then + pushd "$(dirname "${target}")" || exit 1 + 7zz a -p'${{ inputs.encryptionSecret }}' -bso0 -bsp0 -t7z -ms=on -mhe=on "${{ steps.tempdir.outputs.directory }}/archive.7z" "$(basename "${target}")" + popd || exit 1 + fi done - name: Upload archive as artifact