Skip to content

Commit a0ea2ae

Browse files
authored
v1.2.2
2 parents 085798d + 5dc6f9c commit a0ea2ae

File tree

2 files changed

+42
-8
lines changed

2 files changed

+42
-8
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,33 @@ rcdailey/download-tar-action.yml](https://gist.github.com/rcdailey/cd3437bb2c636
1010

1111
## Fixed behavior compared to `actions/upload-artifact`
1212

13+
*tbd*
14+
15+
1. Preserve file permissions
16+
2. Defined root directory from where the content of the tarball is constructed.
17+
18+
## Limitations of `tar`
19+
20+
### On Linux
21+
22+
*tbd*
23+
24+
25+
### On macOS
26+
27+
*tbd*
28+
29+
30+
### On Windows
31+
32+
*tbd*
1333

1434

1535
## Dependencies
1636

1737
* [actions/upload-artifact@v4](https://github.com/actions/upload-artifact)
1838

39+
1940
## Contributors
2041

2142
* [Patrick Lehmann](https://GitHub.com/Paebbels) (Maintainer)

action.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)