Skip to content

Commit

Permalink
[Backport 2.x] Fix Node.js and Yarn installation in CI (#156)
Browse files Browse the repository at this point in the history
Backport #150
to the 2.x branch. Automatic backport failed.

Signed-off-by: Michael Froh <froh@amazon.com>
  • Loading branch information
msfroh committed Mar 7, 2023
1 parent 2b8cf0d commit 1eb4994
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,21 @@ jobs:
ref: ${{ env.OPENSEARCH_VERSION }}
path: OpenSearch-Dashboards

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

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

- name: Move Search Relevance to Plugins Dir
run: mv dashboards-search-relevance OpenSearch-Dashboards/plugins/dashboards-search-relevance
Expand Down

0 comments on commit 1eb4994

Please sign in to comment.