Skip to content

Commit

Permalink
Handle tar in macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Dec 6, 2024
1 parent ebfde41 commit 391fe3e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,33 @@ rcdailey/download-tar-action.yml](https://gist.github.com/rcdailey/cd3437bb2c636

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

*tbd*

1. Preserve file permissions
2. Defined root directory from where the content of the tarball is constructed.

## Limitations of `tar`

### On Linux

*tbd*


### On macOS

*tbd*


### On Windows

*tbd*


## Dependencies

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


## Contributors

* [Patrick Lehmann](https://GitHub.com/Paebbels) (Maintainer)
Expand Down
15 changes: 14 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,21 @@ runs:
done | sort | uniq
}
echo -e "Checking tar ($(which tar)): ${ANSI_CYAN}$(tar --version | head -n 1)${ANSI_NOCOLOR}"
echo -n "Assemble OS specific tar command line options ... "
if [[ "${{ runner.os }}" == "macOS" ]]; then
echo -e "${ANSI_Y}[macOS]${ANSI_NOCOLOR}"
filesFrom=("-T")
elif [[ "${{ runner.os }}" == "Linux" || "${{ runner.os }}" == "Windows" ]]; then
echo -e "${ANSI_LIGHT_GREEN}[${{ runner.os }}]${ANSI_NOCOLOR}"
filesFrom=("--verbatim-files-from" "--files-from")
else
echo -e "${ANSI_LIGHT_RED}[UNSUPPORTED]${ANSI_NOCOLOR}"
exit 1
fi
echo -n "Creating temporary tarball '${tar_directory}${{ inputs.tarball-name }}' ... "
tar -cf "${tar_directory}${{ inputs.tarball-name }}" --verbatim-files-from --files-from <(print_files_unique "${PATTERNS[@]}")
tar -cf "${tar_directory}${{ inputs.tarball-name }}" "${filesFrom[@]}" <(print_files_unique "${PATTERNS[@]}")
if [[ $? -ne 0 ]]; then
echo -e "${ANSI_LIGHT_RED}[FAILED]${ANSI_NOCOLOR}"
exit 1
Expand Down

0 comments on commit 391fe3e

Please sign in to comment.