The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/.github/actions/setup-node/action.yml

107 lines
3.2 KiB

name: 'Setup Node'
description: 'Setup NodeJS'
inputs:
node-version:
required: true
description: 'Node version'
cache-modules:
required: false
description: 'Cache node_modules'
install:
required: false
description: 'Install dependencies'
type: boolean
type:
required: false
description: 'development or production'
type: string
default: 'development'
deno-version:
required: true
description: 'Deno version'
type: string
NPM_TOKEN:
required: false
description: 'NPM token'
HARDENED_MODE:
required: false
description: 'Hardened mode'
default: '0'
outputs:
node-version:
description: 'Node version'
value: ${{ steps.node-version.outputs.node-version }}
cache-deno-hit:
description: 'Exact key hit for Deno cache'
value: ${{ steps.cache-deno.outputs.cache-hit }}
runs:
using: composite
steps:
# Turbo local cache: use rharkor/caching-for-turbo in workflows — not stored here to avoid huge redundant keys.
- name: Cache Deno (apps-engine)
if: inputs.cache-modules
id: cache-deno
uses: actions/cache@v5
with:
path: packages/apps-engine/.deno-cache
key: deno-${{ runner.os }}-${{ runner.arch }}-v${{ inputs.deno-version }}-${{ hashFiles('packages/apps-engine/deno-runtime/deno.lock') }}
restore-keys: |
deno-${{ runner.os }}-${{ runner.arch }}-v${{ inputs.deno-version }}-
- name: Use Node.js ${{ inputs.node-version }}
id: node-version
uses: actions/setup-node@v6.0.0
with:
node-version: ${{ inputs.node-version }}
cache: ${{ inputs.cache-modules && 'yarn' || '' }}
- name: Use Deno ${{ inputs.deno-version }}
uses: denoland/setup-deno@v1
with:
deno-version: ${{ inputs.deno-version }}
- name: Cache mongodb-memory-server binary
if: inputs.cache-modules
uses: actions/cache@v5
with:
path: ${{ runner.temp }}/mongodb-memory-server
key: mongoms-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- name: Configure mongodb-memory-server cache
shell: bash
run: |
CACHE_DIR="${{ runner.temp }}/mongodb-memory-server"
mkdir -p "$CACHE_DIR"
echo "MONGOMS_DOWNLOAD_DIR=$CACHE_DIR" >> $GITHUB_ENV
echo "MONGOMS_PREFER_GLOBAL_PATH=false" >> $GITHUB_ENV
- name: yarn login
shell: bash
if: inputs.NPM_TOKEN
run: |
echo "//registry.npmjs.org/:_authToken=${{ inputs.NPM_TOKEN }}" > ~/.npmrc
- name: yarn config
if: inputs.install
shell: bash
run: |
yarn config set supportedArchitectures --json '{"os": ["linux"], "cpu": ["arm64", "x64"], "libc": ["glibc", "musl"]}'
- name: yarn install
if: inputs.install && inputs.type == 'development'
shell: bash
run: YARN_ENABLE_HARDENED_MODE=${{ inputs.HARDENED_MODE }} yarn
- name: yarn install production
if: inputs.install && inputs.type == 'production'
shell: bash
run: YARN_ENABLE_HARDENED_MODE=${{ inputs.HARDENED_MODE }} yarn workspaces focus --all --production
- name: restore yarn config file
if: inputs.install
shell: bash
run: git checkout -- .yarnrc.yml