-
Notifications
You must be signed in to change notification settings - Fork 186
81 lines (71 loc) · 3.4 KB
/
manual-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
# This workflow builds a production-ready package from the given Git reference.
# Any branch, tag or commit SHA existing in the origin can be used.
#
# This workflow is based on the `dev-environment` workflow.
name: Manual build
on:
workflow_call:
inputs:
reference:
required: true
type: string
default: master
description: Source code reference (branch, tag or commit SHA)
workflow_dispatch:
inputs:
reference:
required: true
type: string
default: master
description: Source code reference (branch, tag or commit SHA)
jobs:
# Build an app package from the given source code reference.
build:
name: Build app package
uses: ./.github/workflows/dev-environment.yml
with:
reference: ${{ inputs.reference }}
command: 'yarn build'
artifact_name: 'wazuh-dashboard-plugins'
secrets: inherit
test-packages:
needs: build
name: Test packages
runs-on: ubuntu-latest
steps:
- name: Step 01 - Download the plugin's source code
uses: actions/checkout@v4
with:
repository: wazuh/wazuh-dashboard-plugins
ref: ${{ inputs.reference }}
path: wazuh
- name: Step 02 - Set variables
run: |
echo "githubReference=$(echo ${{ inputs.reference }} | sed 's/\//-/g')" >> $GITHUB_ENV
echo "currentDir=$(pwd -P)" >> $GITHUB_ENV
echo "version=$(jq -r '.version' $(pwd)/wazuh/plugins/main/package.json)" >> $GITHUB_ENV
echo "revision=$(jq -r '.revision' $(pwd)/wazuh/plugins/main/package.json)" >> $GITHUB_ENV
echo "versionPlatform=$(jq -r '.pluginPlatform.version' $(pwd)/wazuh/plugins/main/package.json)" >> $GITHUB_ENV
- name: Step 03 - Download the main plugin's artifact
uses: actions/download-artifact@v4
with:
name: wazuh-dashboard-plugins_wazuh_${{ env.version }}-${{ env.revision }}_${{ env.githubReference }}.zip
path: ${{ env.currentDir }}/wazuh/scripts/test-packages/plugins/wazuh-dashboard-plugins_wazuh_${{ env.version }}-${{ env.revision }}_${{ env.githubReference }}.zip
overwrite: true
- name: Step 04 - Download the core plugin's artifact
uses: actions/download-artifact@v4
with:
name: wazuh-dashboard-plugins_wazuh-core_${{ env.version }}-${{ env.revision }}_${{ env.githubReference }}.zip
path: ${{ env.currentDir }}/wazuh/scripts/test-packages/plugins/wazuh-dashboard-plugins_wazuh-core_${{ env.version }}-${{ env.revision }}_${{ env.githubReference }}.zip
overwrite: true
- name: Step 05 - Download the check-updates plugin's artifact
uses: actions/download-artifact@v4
with:
name: wazuh-dashboard-plugins_wazuh-check-updates_${{ env.version }}-${{ env.revision }}_${{ env.githubReference }}.zip
path: ${{ env.currentDir }}/wazuh/scripts/test-packages/plugins/wazuh-dashboard-plugins_wazuh-check-updates_${{ env.version }}-${{ env.revision }}_${{ env.githubReference }}.zip
overwrite: true
- name: Step 06 - Build the Docker image
run: |
echo "current=${{ env.currentDir }}"
cd ./wazuh/scripts/test-packages
docker build --build-arg OSD_VERSION=${{ env.versionPlatform }} --build-arg PACKAGE_NAME=wazuh-dashboard-plugins_${{ env.version }}-${{ env.revision }}_${{ env.githubReference }}.zip -f osd-test-packages.Dockerfile ./