ci: ignore missing files when creating archive (#3118)

* Reduce output noise from using 7zip
* Ignore non existent files when creating archive

---------

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2024-05-23 09:24:15 +02:00 committed by GitHub
parent 9c100a542c
commit d0bab9eb08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -37,4 +37,4 @@ runs:
shell: bash shell: bash
run: | run: |
mkdir -p ${{ inputs.path }} 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

View File

@ -47,6 +47,7 @@ runs:
something_exists=true something_exists=true
fi fi
done done
# Create an archive if files exist. # Create an archive if files exist.
# Don't create an archive file if no files are found # Don't create an archive file if no files are found
# and warn. # and warn.
@ -55,11 +56,15 @@ runs:
echo "::warning:: No files/directories found with the provided path(s): ${paths}. No artifact will be uploaded." echo "::warning:: No files/directories found with the provided path(s): ${paths}. No artifact will be uploaded."
exit 0 exit 0
fi fi
for target in ${paths} for target in ${paths}
do do
pushd "$(dirname "${target}")" || exit 1 if [[ -f "${target}" ]]
7zz a -p'${{ inputs.encryptionSecret }}' -t7z -ms=on -mhe=on "${{ steps.tempdir.outputs.directory }}/archive.7z" "$(basename "${target}")" then
popd || exit 1 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 done
- name: Upload archive as artifact - name: Upload archive as artifact