From 5485464aedf2e583f940ad4420b8a1bd36854e70 Mon Sep 17 00:00:00 2001 From: Luc Weinbrecht Date: Tue, 24 May 2022 06:09:03 +0200 Subject: [PATCH] added github action to build and publish plugin --- .github/workflows/build-and-upload.yml | 59 ++++++++++++++++++++++++++ kibana.json | 4 +- 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-and-upload.yml diff --git a/.github/workflows/build-and-upload.yml b/.github/workflows/build-and-upload.yml new file mode 100644 index 0000000..5c95aac --- /dev/null +++ b/.github/workflows/build-and-upload.yml @@ -0,0 +1,59 @@ +name: Build Kibana Plugin & Upload to Release + +on: + push: + tags: + - 'v*' + +jobs: + build-and-upload: + runs-on: ubuntu-latest + steps: + - name: Checkout bpmining Kibana Plugin + uses: actions/checkout@v2 + with: + repository: bpmining/bpmining-kibana-plugin + path: ./plugin + - name: Get Kibana version + id: set_var + run: | + content=`cat ./plugin/kibana.json` + # the following lines are only required for multi line json + content="${content//'%'/'%25'}" + content="${content//$'\n'/'%0A'}" + content="${content//$'\r'/'%0D'}" + # end of optional handling for multi line json + echo "::set-output name=kibanaJson::$content" + - name: Checkout Kibana codebase + uses: actions/checkout@v2 + with: + repository: elastic/kibana + path: ./kibana + ref: "v${{fromJson(steps.set_var.outputs.kibanaJson).kibanaVersion}}" + - name: Move plugin to Kibana directory + run: | + mv ./plugin ./kibana/plugins/${{fromJson(steps.set_var.outputs.kibanaJson).id}} + - name: Use Node.js (.nvmrc) + uses: actions/setup-node@v2 + with: + node-version-file: './kibana/.nvmrc' + cache: 'yarn' + cache-dependency-path: '**/yarn.lock' + - name: Bootstrap Kibana + run: cd ./kibana/plugins/${{fromJson(steps.set_var.outputs.kibanaJson).id}} && yarn kbn bootstrap + - name: Build bpmining plugin + run: cd ./kibana/plugins/${{fromJson(steps.set_var.outputs.kibanaJson).id}} && yarn build + - name: Archive production artifacts + uses: actions/upload-artifact@v2 + with: + name: plugin-zip + path: | + ./kibana/plugins/${{fromJson(steps.set_var.outputs.kibanaJson).id}}/build/*.zip + - name: Upload zip to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./kibana/plugins/${{fromJson(steps.set_var.outputs.kibanaJson).id}}/build/*.zip + tag: ${{ github.ref }} + overwrite: true + file_glob: true diff --git a/kibana.json b/kibana.json index 38b69e0..f919e2b 100755 --- a/kibana.json +++ b/kibana.json @@ -1,7 +1,7 @@ { "id": "bpmining", - "version": "1.0.0", - "kibanaVersion": "kibana", + "version": "0.0.0", + "kibanaVersion": "8.2.0", "owner": { "name": "Anne Schlangstedt, Luc Weinbrecht", "githubTeam": "https://github.com/bpmining"