Skip to content

Commit

Permalink
Pull staging changes upstream. (#113)
Browse files Browse the repository at this point in the history
* Pull dev upstream to staging. (#112)

* Use awk to enclose filename in single quotes tar #99

* Add null field separator so filenames don't get broken up.

* Move upload logs up in the action sequence so it captures data before it gets deleted.

* Fix awk (#109)

---------

Co-authored-by: sn-o-w <[email protected]>

* Fix awk delimiter.

Pull in fix by @sn-o-w in https://github.com/sn-o-w/cache-apt-pkgs-action/commit/d0ee83b497ac30023e51cd526c62e57b07501912 mentioned in issue #99

---------

Co-authored-by: sn-o-w <[email protected]>
  • Loading branch information
awalsh128 and sn-o-w authored Oct 30, 2023
1 parent 6f9e6a8 commit 44c33b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
3 changes: 2 additions & 1 deletion install_and_cache_pkgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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))."
Expand Down

0 comments on commit 44c33b3

Please sign in to comment.