cache-apt-pkgs-action/action.yml

59 lines
1.9 KiB
YAML
Raw Normal View History

2021-10-14 04:11:27 +00:00
name: 'Cache APT Packages'
description: 'Install APT based packages and cache them for future runs.'
author: awalsh128
2021-10-14 05:16:32 +00:00
branding:
icon: 'hard-drive'
color: 'green'
2021-10-14 04:11:27 +00:00
inputs:
packages:
description: 'Space delimited list of packages to install.'
required: true
default: ''
2021-10-16 18:34:03 +00:00
version:
description: 'Version will create a new cache and install packages.'
required: false
2021-10-21 22:44:19 +00:00
default: ''
refresh:
description: 'Option to refresh / upgrade the packages in the same cache.'
required: false
default: 'false'
2021-10-14 04:11:27 +00:00
outputs:
cache-hit:
description: 'A boolean value to indicate a cache was found for the packages requested.'
2021-10-17 04:17:41 +00:00
# This compound expression is needed because lhs can be empty.
# Need to output true and false instead of true and nothing.
2021-10-16 20:16:36 +00:00
value: ${{ steps.load-cache.outputs.cache-hit || false }}
package-version-list:
2021-10-21 22:44:19 +00:00
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 }}
2021-10-14 04:11:27 +00:00
runs:
using: "composite"
steps:
- id: pre-cache
2021-10-17 05:02:56 +00:00
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
2021-10-14 04:11:27 +00:00
shell: bash
- id: load-cache
2022-07-15 19:55:37 +00:00
uses: actions/cache@v3
2021-10-14 04:11:27 +00:00
with:
path: ~/cache-apt-pkgs
2021-10-17 05:02:56 +00:00
key: cache-apt-pkgs_${{ env.CACHE_KEY }}
2021-10-14 04:11:27 +00:00
- id: post-cache
2021-10-21 22:44:19 +00:00
run: |
2021-10-22 04:03:30 +00:00
${{ github.action_path }}/post_cache_action.sh \
2021-10-22 04:30:33 +00:00
~/cache-apt-pkgs \
/ \
2021-10-22 04:03:30 +00:00
"${{ steps.load-cache.outputs.cache-hit }}" \
${{ inputs.packages }}
echo "::set-output name=package-version-list::$(cat ~/cache-apt-pkgs/manifest.log)"
2021-10-21 22:44:19 +00:00
shell: bash