2022-12-15 09:27:04 +00:00

65 lines
2.0 KiB
YAML

name: 'Setup'
description: 'Initialize cache, env var load'
inputs:
enable-cache:
description: 'enable caching'
required: false
type: boolean
default: 'true'
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: ./.github/actions/get-latest-tag-sha
# CACHE
- name: Node cache
id: node-cache
if: ${{ inputs.enable-cache == 'true' }}
uses: actions/cache@v3
env:
cache-name: node-cache
with:
path: |
node_modules
~/.npm
nxcache
dist
key: .npm-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}-${{ steps.tag-sha.outputs.tag_sha }}
restore-keys: |
node-${{ runner.os }}-build-${{ env.cache-name }}-
node-${{ runner.os }}-build-
node-${{ runner.os }}-
- name: pip cache
uses: actions/cache@v3
if: ${{ inputs.enable-cache == 'true' }}
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-
restore-keys: |
${{ runner.os }}
# 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
# sanitize nx calculation flags string
- name: input validation for NX CALCULATION FLAGS
shell: bash
run: |
export NX_CALCULATION_FLAGS=$(echo $NX_CALCULATION_FLAGS | sed "s@'@@g")
echo "NX_CALCULATION_FLAGS=$NX_CALCULATION_FLAGS" >> $GITHUB_ENV
- name: link nx executable
run: sudo ln -s $(npm bin)/nx /usr/bin/nx
shell: bash