Skip to content

Commit 7a60a29

Browse files
authored
Merge pull request #8 from sourcetoad/zip-fix
fix: correct exclude files during zip generation
2 parents cb85ad5 + da9bd2b commit 7a60a29

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

deploy.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ if [ ! -f "$DIR_TO_ZIP/appspec.yml" ]; then
2020
fi
2121

2222
ZIP_FILENAME=$GITHUB_RUN_ID-$GITHUB_SHA.zip
23-
EXCLUDED_FILES_COMMAND=$(sed -En "s/ /-x/p")
2423

25-
zip -r --quiet "$ZIP_FILENAME" "$DIR_TO_ZIP" -x "$EXCLUDED_FILES_COMMAND" -x \*.git\*
24+
# This creates a temp file to explode space delimited excluded files
25+
# into newline delimited exclusions passed to "-x" on the zip command.
26+
EXCLUSION_FILE=$(mktemp /tmp/zip-excluded.XXXXXX)
27+
echo "$INPUT_EXCLUDED_FILES" | tr ' ' '\n' > "$EXCLUSION_FILE"
28+
29+
zip -r --quiet "$ZIP_FILENAME" "$DIR_TO_ZIP" -x "@$EXCLUSION_FILE"
2630
if [ ! -f "$ZIP_FILENAME" ]; then
2731
echo "::error::$ZIP_FILENAME was not generated properly (zip generation failed)."
2832
exit 1;

0 commit comments

Comments
 (0)