mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2024-12-22 18:55:30 +00:00
6d622023ef
Apt installs more packages than just those explicitly listed. This can lead to issues of missing files when the cache is restored.
63 lines
2.2 KiB
YAML
63 lines
2.2 KiB
YAML
name: 'Cache APT Packages'
|
|
description: 'Install APT based packages and cache them for future runs.'
|
|
author: awalsh128
|
|
branding:
|
|
icon: 'hard-drive'
|
|
color: 'green'
|
|
|
|
inputs:
|
|
packages:
|
|
description: 'Space delimited list of packages to install.'
|
|
required: true
|
|
default: ''
|
|
version:
|
|
description: 'Version will create a new cache and install packages.'
|
|
required: false
|
|
default: ''
|
|
refresh:
|
|
description: 'Option to refresh / upgrade the packages in the same cache.'
|
|
required: false
|
|
default: 'false'
|
|
|
|
outputs:
|
|
cache-hit:
|
|
description: 'A boolean value to indicate a cache was found for the packages requested.'
|
|
# This compound expression is needed because lhs can be empty.
|
|
# Need to output true and false instead of true and nothing.
|
|
value: ${{ steps.load-cache.outputs.cache-hit || false }}
|
|
cache-key:
|
|
description: 'The key where the cache is stored with packages, their versions, and the cache version (i.e. package=version package=version @ 1).'
|
|
value: ${{ steps.pre-cache.outputs.cache-key }}
|
|
package-version-list:
|
|
description: 'The packages and versions that are installed as a comma delimited list with colon delimit on the package version (i.e. <package>:<version,<package>:<version>).'
|
|
value: ${{ steps.post-cache.outputs.package-version-list }}
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- id: pre-cache
|
|
run: |
|
|
${{ github.action_path }}/pre_cache_action.sh \
|
|
~/cache-apt-pkgs \
|
|
"${{ inputs.version }}" \
|
|
${{ inputs.packages }}
|
|
echo "CACHE_KEY=$(cat ~/cache-apt-pkgs/cache_key.md5)" >> $GITHUB_ENV
|
|
echo "::set-output name=cache-key::$(cat ~/cache-apt-pkgs/cache_key.md5)"
|
|
shell: bash
|
|
|
|
- id: load-cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/cache-apt-pkgs
|
|
key: cache-apt-pkgs_${{ env.CACHE_KEY }}
|
|
|
|
- id: post-cache
|
|
run: |
|
|
${{ github.action_path }}/post_cache_action.sh \
|
|
~/cache-apt-pkgs \
|
|
/ \
|
|
"${{ steps.load-cache.outputs.cache-hit }}" \
|
|
${{ inputs.packages }}
|
|
echo "::set-output name=package-version-list::$(cat ~/cache-apt-pkgs/manifest.log)"
|
|
shell: bash
|