Add refresh and package version I/O.
This commit is contained in:
parent
aa046d0049
commit
76fa489e74
2 changed files with 38 additions and 5 deletions
16
README.md
16
README.md
|
@ -19,10 +19,13 @@ Create a workflow `.yml` file in your repositories `.github/workflows` directory
|
||||||
|
|
||||||
* `packages` - Space delimited list of packages to install.
|
* `packages` - Space delimited list of packages to install.
|
||||||
* `version` - Version of cache to load. Each version will have its own cache. Note, all characters except spaces are allowed.
|
* `version` - Version of cache to load. Each version will have its own cache. Note, all characters except spaces are allowed.
|
||||||
|
* `refresh` - Refresh / upgrade the packages in the same cache.
|
||||||
|
|
||||||
### Outputs
|
### Outputs
|
||||||
|
|
||||||
* `cache-hit` - A boolean value to indicate a cache was found for the packages requested.
|
* `cache-hit` - A boolean value to indicate a cache was found for the packages requested.
|
||||||
|
* `package_version_list` - The packages and versions that are installed as a comma delimited list with colon delimit on the package version (i.e. \<package1>:<version1\>,\<package2>:\<version2>,...).
|
||||||
|
|
||||||
|
|
||||||
### Cache scopes
|
### Cache scopes
|
||||||
|
|
||||||
|
@ -59,6 +62,19 @@ jobs:
|
||||||
folder: ${{github.workspace}}/build/website
|
folder: ${{github.workspace}}/build/website
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
...
|
||||||
|
install_doxygen_deps:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: awalsh128/cache-apt-pkgs-action@v1
|
||||||
|
with:
|
||||||
|
packages: dia doxygen doxygen-doc doxygen-gui doxygen-latex graphviz mscgen
|
||||||
|
version: 1.0
|
||||||
|
refresh: true # Force refresh / upgrade v1.0 cache.
|
||||||
|
```
|
||||||
|
|
||||||
## Cache Limits
|
## Cache Limits
|
||||||
|
|
||||||
A repository can have up to 5GB of caches. Once the 5GB limit is reached, older caches will be evicted based on when the cache was last accessed. Caches that are not accessed within the last week will also be evicted.
|
A repository can have up to 5GB of caches. Once the 5GB limit is reached, older caches will be evicted based on when the cache was last accessed. Caches that are not accessed within the last week will also be evicted.
|
||||||
|
|
27
action.yml
27
action.yml
|
@ -13,7 +13,11 @@ inputs:
|
||||||
version:
|
version:
|
||||||
description: 'Version will create a new cache and install packages.'
|
description: 'Version will create a new cache and install packages.'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
refresh:
|
||||||
|
description: 'Option to refresh / upgrade the packages in the same cache.'
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
cache-hit:
|
cache-hit:
|
||||||
|
@ -21,6 +25,9 @@ outputs:
|
||||||
# This compound expression is needed because lhs can be empty.
|
# This compound expression is needed because lhs can be empty.
|
||||||
# Need to output true and false instead of true and nothing.
|
# Need to output true and false instead of true and nothing.
|
||||||
value: ${{ steps.load-cache.outputs.cache-hit || false }}
|
value: ${{ steps.load-cache.outputs.cache-hit || false }}
|
||||||
|
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.get-package-versions.outputs.package_version_list }}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
|
@ -42,10 +49,20 @@ runs:
|
||||||
key: cache-apt-pkgs_${{ env.CACHE_KEY }}
|
key: cache-apt-pkgs_${{ env.CACHE_KEY }}
|
||||||
|
|
||||||
- name: Load Packages
|
- name: Load Packages
|
||||||
run: |
|
run: |
|
||||||
if [ ${{ steps.load-cache.outputs.cache-hit }} ]; then
|
if [ ! ${{ steps.load-cache.outputs.cache-hit }} ] || [ ${{ inputs.refresh }} ]; then
|
||||||
${{ github.action_path }}/restore_pkgs.sh ~/cache-apt-pkgs /
|
|
||||||
else
|
|
||||||
${{ github.action_path }}/install_and_cache_pkgs.sh ~/cache-apt-pkgs ${{ inputs.packages }}
|
${{ github.action_path }}/install_and_cache_pkgs.sh ~/cache-apt-pkgs ${{ inputs.packages }}
|
||||||
|
else
|
||||||
|
${{ github.action_path }}/restore_pkgs.sh ~/cache-apt-pkgs /
|
||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
- name: Get Package Versions
|
||||||
|
id: get-package-versions
|
||||||
|
run: |
|
||||||
|
output=
|
||||||
|
for package in ${{ inputs.packages }}; do
|
||||||
|
output=$output,$package:$(dpkg -s xdot | grep Version | awk '{print $2}')
|
||||||
|
done
|
||||||
|
::set-output name=package_version_list::output
|
||||||
|
shell: bash
|
||||||
|
|
Loading…
Reference in a new issue