forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 60
84 lines (69 loc) · 2.67 KB
/
build.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
# This is a basic workflow that is manually triggered
name: Build
on:
workflow_dispatch:
inputs:
CHECKOUT_TO: # This is the branch to checkout to. Defaults to 'master'
description: 'The branch/tag/commit to checkout to'
required: true
default: ''
jobs:
build:
runs-on: ubuntu-latest
name: Build
defaults:
run:
working-directory: ./artifacts
strategy:
matrix:
DISTRIBUTION: [ tar.gz ]
ARCHITECTURE: [ x64, arm64 ]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: ./artifacts
ref: ${{ inputs.CHECKOUT_TO }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: './artifacts/.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g [email protected]
yarn config set network-timeout 1000000 -g
- name: Configure Yarn Cache
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV
- name: Initialize Yarn Cache
uses: actions/cache@v3
with:
path: ${{ env.YARN_CACHE_LOCATION }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Get package version
run: |
echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV
echo "WZD_VERSION=$(yarn --silent wzd-version)" >> $GITHUB_ENV
echo "WZD_REVISION=$(yarn --silent wzd-revision)" >> $GITHUB_ENV
- name: Get artifact build name
run: |
echo "ARTIFACT_BUILD_NAME=wazuh-dashboard_${{ env.WZD_VERSION }}-${{ env.WZD_REVISION }}_${{ matrix.ARCHITECTURE }}_${{ inputs.CHECKOUT_TO }}.${{ matrix.DISTRIBUTION }}" >> $GITHUB_ENV
- name: Run bootstrap
run: yarn osd bootstrap
- name: Build linux-x64
if: matrix.ARCHITECTURE == 'x64'
run: yarn build-platform --linux --skip-os-packages --release
- name: Build linux-arm64
if: matrix.ARCHITECTURE == 'arm64'
run: yarn build-platform --linux-arm --skip-os-packages --release
- name: Rename artifact
run: mv /home/runner/work/wazuh-dashboard/wazuh-dashboard/artifacts/target/opensearch-dashboards-${{ env.VERSION }}-linux-${{ matrix.ARCHITECTURE }}.${{ matrix.DISTRIBUTION }} /home/runner/work/wazuh-dashboard/wazuh-dashboard/artifacts/target/${{ env.ARTIFACT_BUILD_NAME }}
- uses: actions/upload-artifact@v3
if: success()
with:
name: ${{ env.ARTIFACT_BUILD_NAME }}
path: ./artifacts/target/${{ env.ARTIFACT_BUILD_NAME }}
retention-days: 30