Files
alfresco-ng2-components/.github/actions/setup/action.yml
T
2023-01-18 17:15:33 +01:00

80 lines
2.7 KiB
YAML

name: 'Setup'
description: 'Initialize cache, env var load'
inputs:
enable-cache:
description: 'enable caching'
required: false
type: boolean
default: 'true'
enable-node-modules-cache:
description: 'enable caching for node modules'
required: false
type: boolean
default: 'true'
act:
description: 'enable act debug'
required: false
type: boolean
default: 'false'
runs:
using: "composite"
steps:
- name: install NPM
uses: actions/setup-node@v3
with:
node-version: 14
cache-dependency-path: package-lock.json
- name: get latest tag sha
id: tag-sha
uses: Alfresco/alfresco-build-tools/.github/actions/git-latest-tag@v1.29.0
# CACHE
- name: Node cache
id: node-cache
if: ${{ inputs.enable-cache == 'true' }}
uses: actions/cache@v3
env:
cache-name: node-cache
with:
path: |
nxcache
key: nxcache-${{ env.GITHUB_REF_NAME }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}-${{ steps.tag-sha.outputs.tag_sha }}
restore-keys: |
nxcache-${{ env.GITHUB_REF_NAME }}-build-${{ env.cache-name }}-
nxcache-${{ env.GITHUB_REF_NAME }}-build-
nxcache-${{ env.GITHUB_REF_NAME }}-
- name: Node Modules cache
id: node-modules-cache
if: ${{ inputs.enable-node-modules-cache == 'true' }}
uses: actions/cache@v3
env:
cache-name: node-modules-cache
with:
path: |
node_modules
key: .npm-${{ env.GITHUB_REF_NAME }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}-${{ steps.tag-sha.outputs.tag_sha }}
restore-keys: |
node_modules-${{ env.GITHUB_REF_NAME }}-build-${{ env.cache-name }}-
node_modules-${{ env.GITHUB_REF_NAME }}-build-
node_modules-${{ env.GITHUB_REF_NAME }}-
- name: pip cache
uses: actions/cache@v3
if: ${{ inputs.enable-cache == 'true' }}
with:
path: ~/.cache/pip
key: ${{ env.GITHUB_REF_NAME }}-pip-
restore-keys: |
${{ env.GITHUB_REF_NAME }}
# ENV LOAD
- name: load .travis.yml env.global variables
uses: Alfresco/alfresco-build-tools/.github/actions/travis-env-load@v1.17.0
with:
yml_path: .travis.yml
- name: load "TRAVIS_EVENT_TYPE"
uses: ./.github/actions/travis-env-var-facade
- name: before install script
uses: ./.github/actions/before-install
with:
act: ${{ inputs.act }}
- name: link nx executable
run: sudo ln -s $(npm bin)/nx /usr/bin/nx
shell: bash