-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to build/release plugins for OpenSearch
With this workflow for GitHub actions, the plugin will be built and released when a new tag with the prefix 'osd-' is created. This implies that all the tags that start with that prefix will build versions for OpenSearch. This commit also updates the version of OpenSearch to the latest. It's neccesary to build the plugin with the exact dependencies for that version. Signed-off-by: Santiago Dueñas <[email protected]>
- Loading branch information
Showing
4 changed files
with
104 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'osd-*.*.*' | ||
- 'osd-*.*.*-*' | ||
|
||
jobs: | ||
build: | ||
name: Build plugin | ||
runs-on: ubuntu-latest | ||
outputs: | ||
filename: ${{ steps.build_zip.outputs.filename }} | ||
steps: | ||
- name: Checkout plugin source code | ||
uses: actions/checkout@v2 | ||
with: | ||
path: plugin | ||
- name: Get plugin metadata | ||
id: plugin_metadata | ||
run: | | ||
echo "::set-output name=name::$(node -p "(require('./plugin/package.json').name)")" | ||
echo "::set-output name=version::$(node -p "(require('./plugin/package.json').version).match(/[.0-9]+/)[0]")" | ||
- name: Get OpenSearch Dashboards version | ||
id: osd_version | ||
run: | | ||
echo "::set-output name=version::$(node -p "(require('./plugin/opensearch_dashboards.json').opensearchDashboardsVersion).match(/[.0-9]+/)[0]")" | ||
- name: Checkout OpenSearch Dashboards | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: opensearch-project/OpenSearch-Dashboards | ||
ref: ${{ steps.osd_version.outputs.version }} | ||
path: osd | ||
- name: Get node and yarn versions | ||
id: versions | ||
run: | | ||
echo "::set-output name=node_version::$(node -p "(require('./osd/package.json').engines.node).match(/[.0-9]+/)[0]")" | ||
echo "::set-output name=yarn_version::$(node -p "(require('./osd/package.json').engines.yarn).match(/[.0-9]+/)[0]")" | ||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ steps.versions.outputs.node_version }} | ||
- name: Setup yarn | ||
run: | | ||
npm uninstall -g yarn | ||
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}" | ||
npm i -g yarn@${{ steps.versions.outputs.yarn_version }} | ||
- name: Move plugin to OpenSearch Dashboards folder | ||
run: | | ||
mkdir -p osd/plugins | ||
mv plugin osd/plugins | ||
- name: Bootstrap plugin/opensearch-dashboards | ||
run: | | ||
cd osd/plugins/plugin | ||
yarn osd bootstrap | ||
- name: Build plugin | ||
id: build_zip | ||
run: | | ||
cd osd/plugins/plugin | ||
yarn build | ||
tmp_zip_path=`ls $(pwd)/build/*.zip` | ||
filename=${{ steps.plugin_metadata.outputs.name }}-${{ steps.plugin_metadata.outputs.version }}_${{ steps.osd_version.outputs.version }}.zip | ||
zip_path=$(pwd)/build/$filename | ||
mv $tmp_zip_path $zip_path | ||
echo "::set-output name=zip_path::$zip_path" | ||
echo "::set-output name=filename::$filename" | ||
- name: Upload plugin artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: plugin_artifact | ||
path: ${{ steps.build_zip.outputs.zip_path }} | ||
|
||
release: | ||
name: Release plugin | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get release tag | ||
id: tag | ||
run: | | ||
echo ::set-output name=tag::${GITHUB_REF#refs/tags/} | ||
shell: bash | ||
- name: Checkout plugin source code | ||
uses: actions/checkout@v2 | ||
with: | ||
path: plugin | ||
- name: Download plugin artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: plugin_artifact | ||
path: plugin/build | ||
- name: Create release | ||
run: | | ||
cd plugin | ||
gh release create ${{ steps.tag.outputs.tag }} build/${{ needs.build.outputs.filename }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,6 @@ | |
# yarn lockfile v1 | ||
|
||
|
||
[email protected]: | ||
version "2.0.2" | ||
resolved "https://registry.yarnpkg.com/expr-eval/-/expr-eval-2.0.2.tgz#fa6f044a7b0c93fde830954eb9c5b0f7fbc7e201" | ||
integrity sha512-4EMSHGOPSwAfBiibw3ndnP0AvjDWLsMvGOvWEZ2F96IGk0bIVdjQisOHxReSkE13mHcfbuCiXw+G4y0zv6N8Eg== | ||
|
||
keycharm@^0.2.0: | ||
version "0.2.0" | ||
resolved "https://registry.yarnpkg.com/keycharm/-/keycharm-0.2.0.tgz#fa6ea2e43b90a68028843d27f2075d35a8c3e6f9" | ||
|
@@ -22,10 +17,10 @@ moment@^2.24.0: | |
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" | ||
integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== | ||
|
||
randomcolor@^0.5.0: | ||
version "0.5.4" | ||
resolved "https://registry.yarnpkg.com/randomcolor/-/randomcolor-0.5.4.tgz#df615b13f25b89ea58c5f8f72647f0a6f07adcc3" | ||
integrity sha512-nYd4nmTuuwMFzHL6W+UWR5fNERGZeVauho8mrJDUSXdNDbao4rbrUwhuLgKC/j8VCS5+34Ria8CsTDuBjrIrQA== | ||
[email protected].3: | ||
version "0.5.3" | ||
resolved "https://registry.yarnpkg.com/randomcolor/-/randomcolor-0.5.3.tgz#7f90f2f2a7f6d5a52232161eeaeeaea9ac3b5815" | ||
integrity sha1-f5Dy8qf21aUiMhYe6u6uqaw7WBU= | ||
|
||
vis-data@^6.5.1: | ||
version "6.6.1" | ||
|