Skip to content

Commit da7f386

Browse files
AMoo-MikiAWSHurneyt
authored andcommitted
Fix Node.js and Yarn installation in CI (opensearch-project#446)
Signed-off-by: Miki <[email protected]> Signed-off-by: AWSHurneyt <[email protected]>
1 parent a3e580e commit da7f386

File tree

2 files changed

+22
-25
lines changed

2 files changed

+22
-25
lines changed

.github/workflows/cypress-workflow.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,21 @@ jobs:
6464
with:
6565
path: OpenSearch-Dashboards/plugins/security-analytics-dashboards-plugin
6666

67-
- name: Get node and yarn versions
68-
id: versions
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.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.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+
- run: node -v
81+
- run: yarn -v
8482

8583
- name: Bootstrap plugin/OpenSearch-Dashboards
8684
run: |

.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)