1+ name : Release workflow
2+ # This workflow is triggered on creating tags to master or an opendistro release branch
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+
8+ jobs :
9+ build :
10+ name : Build Alerting Kibana
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout Alerting Kibana plugin
14+ uses : actions/checkout@v2
15+ with :
16+ path : alerting-kibana-plugin
17+ - name : Get Kibana version
18+ id : kibana_version
19+ run : |
20+ echo "::set-output name=kibana_version::$(node -p "(require('./alerting-kibana-plugin/package.json').kibana.version).match(/[.0-9]+/)[0]")"
21+ - name : Checkout Kibana
22+ uses : actions/checkout@v2
23+ with :
24+ repository : opendistro-for-elasticsearch/kibana-oss
25+ ref : ${{ steps.kibana_version.outputs.kibana_version }}
26+ token : ${{ secrets.GITHUB_KIBANA_OSS }}
27+ path : kibana
28+ - name : Get node and yarn versions
29+ id : versions
30+ run : |
31+ echo "::set-output name=node_version::$(node -p "(require('./kibana/package.json').engines.node).match(/[.0-9]+/)[0]")"
32+ echo "::set-output name=yarn_version::$(node -p "(require('./kibana/package.json').engines.yarn).match(/[.0-9]+/)[0]")"
33+ - name : Setup node
34+ uses : actions/setup-node@v1
35+ with :
36+ node-version : ${{ steps.versions.outputs.node_version }}
37+ registry-url : ' https://registry.npmjs.org'
38+ - name : Install correct yarn version for Kibana
39+ run : |
40+ npm uninstall -g yarn
41+ echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
42+ npm i -g yarn@${{ steps.versions.outputs.yarn_version }}
43+ - name : Bootstrap plugin/kibana
44+ run : |
45+ mkdir -p kibana/plugins
46+ mv alerting-kibana-plugin kibana/plugins
47+ cd kibana/plugins/alerting-kibana-plugin
48+ yarn kbn bootstrap
49+ - name : Build plugin
50+ id : build_zip
51+ run : |
52+ cd kibana/plugins/alerting-kibana-plugin
53+ yarn build
54+ zip_path=`ls $(pwd)/build/*.zip`
55+ echo "::set-output name=zip_path::$zip_path"
56+ - name : Configure AWS Credentials
57+ uses : aws-actions/configure-aws-credentials@v1
58+ with :
59+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
60+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
61+ aws-region : us-west-2
62+ - name : Upload Artifacts to S3
63+ run : |
64+ s3_path=s3://artifacts.opendistroforelasticsearch.amazon.com/downloads
65+ aws s3 cp ${{ steps.build_zip.outputs.zip_path }} $s3_path/kibana-plugins/opendistro-alerting/
66+ aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths '/downloads/*'
67+ - name : Create Github Draft Release
68+ id : create_release
69+ uses : actions/create-release@v1.0.0
70+ env :
71+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
72+ with :
73+ tag_name : ${{ github.ref }}
74+ release_name : Release ${{ github.ref }}
75+ draft : true
76+ prerelease : false
77+ - name : Upload Release Asset
78+ uses : actions/upload-release-asset@v1.0.1
79+ env :
80+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
81+ with :
82+ upload_url : ${{ steps.create_release.outputs.upload_url }}
83+ asset_name : opendistro_alerting_kibana.zip
84+ asset_path : ${{ steps.build_zip.outputs.zip_path }}
85+ asset_content_type : application/zip
86+ - name : Upload Workflow Artifacts
87+ uses : actions/upload-artifact@v1
88+ with :
89+ name : alerting-plugin
90+ path : ${{ steps.build_zip.outputs.zip_path }}
91+
0 commit comments