Skip to content

Commit d873f0d

Browse files
author
Miki
committed
Fix Node.js and Yarn installation in CI
Signed-off-by: Miki <[email protected]>
1 parent 9a62208 commit d873f0d

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

.github/workflows/unit-tests-workflow.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,20 @@ jobs:
2626
repository: opensearch-project/OpenSearch-Dashboards
2727
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
2828
path: OpenSearch-Dashboards
29-
- name: Get node and yarn versions
30-
id: versions
31-
run: |
32-
echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")"
33-
echo "::set-output name=yarn_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.yarn).match(/[.0-9]+/)[0]")"
34-
- name: Setup node
35-
uses: actions/setup-node@v1
29+
- name: Setup Node
30+
uses: actions/setup-node@v3
3631
with:
37-
node-version: ${{ steps.versions.outputs.node_version }}
32+
node-version-file: './OpenSearch-Dashboards/.nvmrc'
3833
registry-url: 'https://registry.npmjs.org'
39-
- name: Install correct yarn version for OpenSearch-Dashboards
34+
- name: Install Yarn
35+
# Need to use bash to avoid having a windows/linux specific step
36+
shell: bash
4037
run: |
41-
npm uninstall -g yarn
42-
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
43-
npm i -g yarn@${{ steps.versions.outputs.yarn_version }}
38+
YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn")
39+
echo "Installing yarn@$YARN_VERSION"
40+
npm i -g yarn@$YARN_VERSION
41+
- run: node -v
42+
- run: yarn -v
4443
- name: Checkout Security Analytics Dashboards plugin
4544
uses: actions/checkout@v2
4645
with:

0 commit comments

Comments
 (0)