Skip to content

Commit

Permalink
Fix upload action uploading whole directory structure instead of targ…
Browse files Browse the repository at this point in the history
…et files

Signed-off-by: Daniel Weiße <[email protected]>
  • Loading branch information
daniel-weisse committed Dec 21, 2023
1 parent 5931a11 commit fa11bee
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions .github/actions/artifact_upload/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,30 @@ runs:
# Check if any file matches the given pattern(s).
something_exists=false
for pattern in ${paths}; do
if compgen -G ${pattern} > /dev/null; then
for pattern in ${paths}
do
if compgen -G "${pattern}" > /dev/null; then
something_exists=true
fi
done
# Create an archive if files exist.
# Don't create an archive file if no files are found
# and warn.
if ${something_exists}; then
zip -e -P '${{ inputs.encryptionSecret }}' -qq -r ${{ steps.tempdir.outputs.directory }}/archive.zip ${paths}
else
if ! ${something_exists}
then
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
echo "Adding ${target} to archive"
pushd "$(dirname "${target}")" || exit 1
zip -e -P '${{ inputs.encryptionSecret }}' -r "${{ steps.tempdir.outputs.directory }}/archive.zip" "$(basename "${target}")"
popd || exit 1
done
- name: Upload archive as artifact
uses: actions/upload-artifact@v3
with:
Expand Down

0 comments on commit fa11bee

Please sign in to comment.