-
Notifications
You must be signed in to change notification settings - Fork 7
/
action.yml
57 lines (54 loc) · 1.66 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: setup-env
description: Initializes environment.
inputs:
node-version:
description: Override Node Version
required: false
default: ''
cache-prefix:
description: Additional cache prefix
required: false
default: 'default'
outputs:
node-version:
value: ${{ steps.detect-node.outputs.version }}
description: Detected Node version.
runs:
using: "composite"
steps:
- name: Detect Node Version
id: detect-node
run: |
if [[ -z "${{ inputs.node-version }}" ]]; then
echo "version=$(cat .nvmrc | tr -d '\n')" >> $GITHUB_OUTPUT
else
echo "version=${{ inputs.node-version }}" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Install NodeJS
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
with:
node-version: ${{ steps.detect-node.outputs.version }}
- name: Enable Corepack
run: corepack enable
shell: bash
- name: Restore Yarn Cache
id: yarn-cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: |
.yarn/cache
.pnp.*
key: ${{ inputs.cache-prefix }}-${{ steps.detect-node.outputs.version }}-${{ hashFiles('yarn.lock') }}
- name: Install Yarn Project
run: yarn install --immutable
shell: bash
- name: Create Artifacts Directory
run: mkdir -p artifacts
shell: bash
- name: Configure Git
run: |
git config --global user.name tophat-opensource-bot
git config --global user.email opensource-leads+bot@tophatmonocle.com
git config --global init.defaultBranch main
shell: bash