Skip to content

Commit

Permalink
Fix Node.js and Yarn installation in CI (opensearch-project#64) (open…
Browse files Browse the repository at this point in the history
…search-project#67)

Signed-off-by: Miki <miki@amazon.com>
(cherry picked from commit 6c9b69b29e0c5ce930b98cb0dadca2b3855b652e)

Co-authored-by: Miki <amoo_miki@yahoo.com>
  • Loading branch information
opensearch-trigger-bot[bot] and AMoo-Miki authored Feb 22, 2023
1 parent 50598a2 commit 5c5a207
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 28 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/dashboards-reports-release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ jobs:
ref: ${{ env.OPENSEARCH_VERSION }}
path: dashboards-reports/OpenSearch-Dashboards

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: "10.24.1"

- name: Move Dashboards Reports to Plugins Dir
run: mv dashboards-reports OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}

Expand All @@ -49,6 +44,23 @@ jobs:
unzip chromium-linux-x64.zip
rm chromium-linux-x64.zip
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: './OpenSearch-Dashboards/.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Install Yarn
# Need to use bash to avoid having a windows/linux specific step
shell: bash
run: |
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: OpenSearch Dashboards Plugin Bootstrap
uses: nick-invision/retry@v1
with:
Expand Down
63 changes: 40 additions & 23 deletions .github/workflows/dashboards-reports-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,25 @@ jobs:
ref: ${{ env.OPENSEARCH_VERSION }}
path: OpenSearch-Dashboards

- name: Get node version
id: versions_step
run: echo "::set-output name=node_version::$(node -p "(require('../OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")"

- name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ steps.versions_step.outputs.node_version }}
node-version-file: '../OpenSearch-Dashboards/.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Install Yarn
# Need to use bash to avoid having a windows/linux specific step
shell: bash
run: |
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: Checkout Plugin
uses: actions/checkout@v1
uses: actions/checkout@v1
with:
path: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}

Expand Down Expand Up @@ -82,20 +89,25 @@ jobs:
ref: ${{ env.OPENSEARCH_VERSION }}
path: OpenSearch-Dashboards

- name: Get node version
id: versions_step
run:
echo "::set-output name=node_version::$(node -p "(require('../OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")"

- name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ steps.versions_step.outputs.node_version }}
node-version-file: '../OpenSearch-Dashboards/.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Install Yarn
# Need to use bash to avoid having a windows/linux specific step
shell: bash
run: |
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: Checkout Plugin
uses: actions/checkout@v1
uses: actions/checkout@v1
with:
path: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}

Expand Down Expand Up @@ -134,20 +146,25 @@ jobs:
ref: ${{ env.OPENSEARCH_VERSION }}
path: OpenSearch-Dashboards

- name: Get node version
id: versions_step
run:
echo "::set-output name=node_version::$(node -p "(require('../OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")"

- name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ steps.versions_step.outputs.node_version }}
node-version-file: '../OpenSearch-Dashboards/.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Install Yarn
# Need to use bash to avoid having a windows/linux specific step
shell: bash
run: |
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: Checkout Plugin
uses: actions/checkout@v1
uses: actions/checkout@v1
with:
path: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}

Expand Down

0 comments on commit 5c5a207

Please sign in to comment.