diff --git a/action.yml b/action.yml index 035ace6..3e0dd2f 100644 --- a/action.yml +++ b/action.yml @@ -83,6 +83,13 @@ runs: DEBUG: "${{ inputs.debug }}" PACKAGES: "${{ inputs.packages }}" + - id: upload-logs + if: ${{ inputs.debug == 'true' }} + uses: actions/upload-artifact@v3 + with: + name: cache-apt-pkgs-logs_${{ env.CACHE_KEY }} + path: ~/cache-apt-pkgs/*.log + - id: save-cache if: ${{ ! steps.load-cache.outputs.cache-hit }} uses: actions/cache/save@v3 @@ -94,10 +101,3 @@ runs: run: | rm -rf ~/cache-apt-pkgs shell: bash - - - id: upload-logs - if: ${{ inputs.debug == 'true' }} - uses: actions/upload-artifact@v3 - with: - name: cache-apt-pkgs-logs_${{ env.CACHE_KEY }} - path: ~/cache-apt-pkgs/*.log diff --git a/install_and_cache_pkgs.sh b/install_and_cache_pkgs.sh index f81dacd..a35971f 100755 --- a/install_and_cache_pkgs.sh +++ b/install_and_cache_pkgs.sh @@ -92,7 +92,8 @@ for installed_package in ${installed_packages}; do & get_install_script_filepath "" "${package_name}" "preinst" \ & get_install_script_filepath "" "${package_name}" "postinst"; } | while IFS= read -r f; do test -f "${f}" -o -L "${f}" && get_tar_relpath "${f}"; done | - xargs -I {} echo \'{}\' | # Single quotes ensure literals like backslash get captured. + # Single quotes ensure literals like backslash get captured. Use \0 to avoid field separation. + awk -F"\0" '{print "\x27"$1"\x27"}' | sudo xargs tar -cf "${cache_filepath}" -C / log " done (compressed size $(du -h "${cache_filepath}" | cut -f1))."