Files
tom.coursow 61f5f4ef43
Deployment / lint (push) Successful in 26s
Deployment / test (push) Successful in 35s
Deployment / build (push) Successful in 19s
Deployment / deploy (push) Successful in 8s
action.yml aktualisiert
2023-07-28 22:31:47 +02:00

47 lines
1.8 KiB
YAML

#
# To be able to use this action (with Gitea and Act Runner),
# this action.yml file has to be placed in the root of the repository.
# It is also important that a Git TAG is created (for example 'v1')
# Then workflows can use this action like this:
# 'using: https://gitea.coursow.de/Test-Playground/actions-custom-composite@v1'
#
# Name and Description of the Action (Like displayed in GitHub Marketplace Overview)
name: 'Get & Cache Dependencies'
description: 'Get the Dependencies from the cache for a (npm) Node JS Project or initialize the cache for it'
# Inputs can be given with the 'with:' key later when using the custom action
inputs:
caching:
description: 'If the cache should be used or not'
required: false
default: 'true'
outputs:
cache-hit:
description: 'Provides information if the cache was used during the action execution (true) or not (false)'
value: ${{ steps.install.outputs.cache-hit }}
runs:
using: 'composite' # Must be 'composite' for a custom composite action
steps:
- uses: KEINOS/gh-action-hash-for-cache@v2.0.0-alpha
id: get-cache-hash
if: inputs.caching == 'true'
with:
path: |
package-lock.json
- name: Cache dependencies
id: cache
if: inputs.caching == 'true'
uses: actions/cache@v3
with:
path: node_modules
key: deps-node-modules-${{ steps.get-cache-hash.outputs.hash }}
- name: Install dependencies
id: install
if: steps.cache.outputs.cache-hit != 'true' || inputs.caching != 'true'
run: |
npm ci
echo "cache-hit='true'" >> $GITHUB_OUTPUT
shell: bash # compared to workflow ymls... Action ymls require the 'shell' property when a 'run' property was used!