Skip to content

Commit bb3f185

Browse files
authored
Fix Node.js and Yarn installation in CI (#433)
Signed-off-by: Miki <miki@amazon.com>
1 parent 75832b6 commit bb3f185

File tree

2 files changed

+23
-25
lines changed

2 files changed

+23
-25
lines changed

.github/workflows/remote-integ-tests-workflow.yml

+12-13
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,22 @@ jobs:
6464
with:
6565
path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin
6666

67-
- name: Get node and yarn versions
68-
id: versions_step
69-
run: |
70-
echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")"
71-
echo "::set-output name=yarn_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.yarn).match(/[.0-9]+/)[0]")"
72-
73-
- name: Setup node
74-
uses: actions/setup-node@v1
67+
- name: Setup Node
68+
uses: actions/setup-node@v3
7569
with:
76-
node-version: ${{ steps.versions_step.outputs.node_version }}
70+
node-version-file: './OpenSearch-Dashboards/.nvmrc'
7771
registry-url: 'https://registry.npmjs.org'
7872

79-
- name: Install correct yarn version for OpenSearch Dashboards
73+
- name: Install Yarn
74+
# Need to use bash to avoid having a windows/linux specific step
75+
shell: bash
8076
run: |
81-
npm uninstall -g yarn
82-
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
83-
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
77+
YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn")
78+
echo "Installing yarn@$YARN_VERSION"
79+
npm i -g yarn@$YARN_VERSION
80+
81+
- run: node -v
82+
- run: yarn -v
8483

8584
- name: Bootstrap the plugin
8685
run: |

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

+11-12
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_step
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_step.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_step.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 Anomaly Detection OpenSearch Dashboards plugin
4544
uses: actions/checkout@v2
4645
with:

0 commit comments

Comments
 (0)