@@ -109,22 +109,22 @@ runs:
109109 echo -e "${ANSI_LIGHT_GREEN}[OK]${ANSI_NOCOLOR}"
110110
111111 dir="${{ inputs.working-directory }}"
112- tar_directory =""
112+ tarDirectory =""
113113 while [[ "${dir}" != "." ]]; do
114- tar_directory ="../${tar_directory }"
114+ tarDirectory ="../${tarDirectory }"
115115 dir=$(dirname -- "${dir}")
116116 done
117- echo "tar_directory : ${tar_directory }"
117+ echo " tarDirectory : ${tarDirectory }"
118118 fi
119119 else
120120 echo -e "echo -e ${ANSI_LIGHT_RED}[NO DIRECTORY]${ANSI_NOCOLOR}"
121121 exit 1
122122 fi
123123 else
124- tar_directory =""
124+ tarDirectory =""
125125 fi
126126
127- echo -n "Resolving provided file patterns ... "
127+ echo -n "Convert provided file patterns to a single line ... "
128128 PATTERNS=()
129129 while IFS=$'\r\n' read -r pattern; do
130130 # skip empty or comment lines
@@ -140,16 +140,29 @@ runs:
140140 done | sort | uniq
141141 }
142142
143- echo -n "Creating temporary tarball '${tar_directory}${{ inputs.tarball-name }}' ... "
144- tar -cf "${tar_directory}${{ inputs.tarball-name }}" --verbatim-files-from --files-from <(print_files_unique "${PATTERNS[@]}")
143+ echo -e "Checking tar ($(which tar)): ${ANSI_CYAN}$(tar --version | head -n 1)${ANSI_NOCOLOR}"
144+ echo -n "Assemble OS specific tar command line options ... "
145+ if [[ "${{ runner.os }}" == "macOS" ]]; then
146+ echo -e "${ANSI_Y}[macOS]${ANSI_NOCOLOR}"
147+ filesFrom=("-T")
148+ elif [[ "${{ runner.os }}" == "Linux" || "${{ runner.os }}" == "Windows" ]]; then
149+ echo -e "${ANSI_LIGHT_GREEN}[${{ runner.os }}]${ANSI_NOCOLOR}"
150+ filesFrom=("--verbatim-files-from" "--files-from")
151+ else
152+ echo -e "${ANSI_LIGHT_RED}[UNSUPPORTED]${ANSI_NOCOLOR}"
153+ exit 1
154+ fi
155+
156+ echo -n "Creating temporary tarball '${tarDirectory}${{ inputs.tarball-name }}' ... "
157+ tar -cf "${tarDirectory}${{ inputs.tarball-name }}" "${filesFrom[@]}" <(print_files_unique "${PATTERNS[@]}")
145158 if [[ $? -ne 0 ]]; then
146159 echo -e "${ANSI_LIGHT_RED}[FAILED]${ANSI_NOCOLOR}"
147160 exit 1
148161 else
149162 echo -e "${ANSI_LIGHT_GREEN}[OK]${ANSI_NOCOLOR}"
150163 fi
151164
152- echo -e "${ANSI_CYAN}Files collected: $(tar -tf '${{ inputs.tarball-name }}' | wc -l)${ANSI_NOCOLOR}"
165+ echo -e "${ANSI_CYAN}Files collected: $(tar -tf "${tarDirectory}${{ inputs.tarball-name }}" | wc -l)${ANSI_NOCOLOR}"
153166
154167 # https://github.com/actions/upload-artifact
155168 - name : Upload artifact
0 commit comments