42 lines
1.3 KiB
YAML
42 lines
1.3 KiB
YAML
|
name: 'Cache APT Packages'
|
||
|
description: 'Install APT based packages and cache them for future runs.'
|
||
|
author: awalsh128
|
||
|
|
||
|
inputs:
|
||
|
packages:
|
||
|
description: 'Space delimited list of packages to install.'
|
||
|
required: true
|
||
|
default: ''
|
||
|
|
||
|
outputs:
|
||
|
cache-hit:
|
||
|
description: 'A boolean value to indicate a cache was found for the packages requested.'
|
||
|
value: ${{ steps.load-pkg-cache.outputs.cache-hit }}
|
||
|
|
||
|
runs:
|
||
|
using: "composite"
|
||
|
steps:
|
||
|
- name: Validate Packages
|
||
|
run: ${{ github.action_path }}/validate_pkgs.sh ${{ inputs.packages }}
|
||
|
|
||
|
- name: Create Cache Key
|
||
|
run: echo ${{ inputs.packages }} | sed 's/[\s,]+/\n/g' | sort > /tmp/package_list.txt
|
||
|
shell: bash
|
||
|
|
||
|
- name: Load Package Cache
|
||
|
id: load-pkg-cache
|
||
|
uses: actions/cache@v2
|
||
|
with:
|
||
|
path: ~/cache-apt-pkgs
|
||
|
key: cache-apt-pkgs_${{ hashFiles('/tmp/package_list.txt') }}
|
||
|
|
||
|
- name: Install and Cache Packages
|
||
|
run: ${{ github.action_path }}/install_and_cache.sh ~/cache-apt-pkgs ${{ inputs.packages }}
|
||
|
shell: bash
|
||
|
if: steps.cache-primes.outputs.cache-hit != 'true'
|
||
|
|
||
|
- name: Restore Cached Packages
|
||
|
run: ${{ github.action_path }}/run.sh ~/cache-apt-pkgs /
|
||
|
shell: bash
|
||
|
if: steps.cache-primes.outputs.cache-hit != 'true'
|