-
Notifications
You must be signed in to change notification settings - Fork 91
95 lines (92 loc) · 3.8 KB
/
release-workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Release workflow
# This workflow is triggered on creating tags to main or an opensearch release branch
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build Alerting OpenSearch Dashboards
runs-on: ubuntu-latest
steps:
- name: Checkout Alerting OpenSearch Dashboards plugin
uses: actions/checkout@v2
with:
path: alerting-dashboards-plugin
- name: Get OpenSearch Dashboards version
id: opensearch_dashboards_version
run: |
echo "::set-output name=opensearch_dashboards_version::$(node -p "(require('./alerting-dashboards-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.opensearch_dashboards_version.outputs.opensearch_dashboards_version }}
token: ${{ secrets.GITHUB_OPENSEARCH_DASHBOARDS_OSS }}
path: opensearchDashboards
- 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: Bootstrap plugin/opensearch-dashboards
run: |
mkdir -p Opensearch-Dashboards/plugins
mv alerting-dashboards-plugin Opensearch-Dashboards/plugins
cd Opensearch-Dashboards/plugins/alerting-dashboards-plugin
yarn osd bootstrap --single-version=loose
- name: Build plugin
id: build_zip
run: |
cd Opensearch-Dashboards/plugins/alerting-dashboards-plugin
yarn build
zip_path=`ls $(pwd)/build/*.zip`
echo "::set-output name=zip_path::$zip_path"
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_STAGING_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_STAGING_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Upload Artifacts to S3
run: |
zip=${{ steps.build_zip.outputs.zip_path }}
# inject build number before the suffix
zip_outfile=`basename ${zip%.zip}-build-${GITHUB_RUN_NUMBER}.zip`
# TODO: Change s3 location
s3_prefix="s3://staging.artifacts.opendistroforelasticsearch.amazon.com/snapshots/opensearch-dashboards-plugins/alerting/"
echo "Copying ${zip} to ${s3_prefix}${zip_outfile}"
aws s3 cp --quiet $zip ${s3_prefix}${zip_outfile}
- name: Create Github Draft Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
- name: Upload Release Asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: opensearch_alerting_dashboards.zip
asset_path: ${{ steps.build_zip.outputs.zip_path }}
asset_content_type: application/zip
- name: Upload Workflow Artifacts
uses: actions/upload-artifact@v4
with:
name: alerting-plugin
path: ${{ steps.build_zip.outputs.zip_path }}