Skip to content

Commit

Permalink
Diferents jobs for deb and rpm packages
Browse files Browse the repository at this point in the history
  • Loading branch information
yenienserrano committed Dec 15, 2023
1 parent c068e3f commit e6b2a7a
Showing 1 changed file with 86 additions and 8 deletions.
94 changes: 86 additions & 8 deletions .github/workflows/build_wazuh_dashboard_with_plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
required: true
default: ''
DISTRIBUTION:
description: 'Distribution to build (--deb | --rpm | --tar | --all-platforms)'
description: 'Distribution to build (deb | rpm | tar | all-platforms)'
required: true
default: ''

Expand All @@ -40,7 +40,7 @@ jobs:
reference: ${{ inputs.REFERENCE_SECURITY_PLUGIN }}


Build-final-packages:
Build-base-package:
needs: [build-plugins, build-dashboard, build-security-plugin]
runs-on: ubuntu-latest
name: Generate final packages
Expand Down Expand Up @@ -105,30 +105,108 @@ jobs:
-a file://${{env.CURRENT_DIR}}/artifacts/wazuh-package.zip \
-s file://${{env.CURRENT_DIR}}/artifacts/security-package.zip \
-b file://${{env.CURRENT_DIR}}/artifacts/dashboard-package.zip \
${{ inputs.DISTRIBUTION }}
--tar
- name: Upload tar packages
uses: actions/upload-artifact@v3
if: success() && ( contains(inputs.DISTRIBUTION, 'tar') || contains(inputs.DISTRIBUTION, 'all-platforms') )
with:
name: wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz
path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/output/wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz
retention-days: 30

build-deb-package:
needs: [Build-base-package]
if: ( contains(inputs.DISTRIBUTION, 'deb') || contains(inputs.DISTRIBUTION, 'all-platforms') )
runs-on: ubuntu-latest
name: Build deb package
strategy:
fail-fast: false
matrix:
# TODO: Add arm64 support
ARCHITECTURE: [ x64 ]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Setup variables
run: |
echo "CURRENT_DIR=$(pwd -P)" >> $GITHUB_ENV
echo "VERSION=$(yarn --silent wzd-version)" >> $GITHUB_ENV
echo "REVISION=$(yarn --silent wzd-revision)" >> $GITHUB_ENV
- name: Download dashboard artifact
uses: actions/download-artifact@v3
with:
name: wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz
path: ${{ env.CURRENT_DIR }}/artifacts/dashboard-tar

- name: Build packages
run: |
cd ${{ env.CURRENT_DIR }}/dev-tools/build-packages/deb/
bash ./launcher.sh \
-v ${{ env.VERSION }} \
-r ${{ env.REVISION }} \
-p file://${{env.CURRENT_DIR}}/artifacts/dashboard-tar/wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz
- name: Upload deb packages
uses: actions/upload-artifact@v3
if: success() && ( contains(inputs.DISTRIBUTION, 'deb') || contains(inputs.DISTRIBUTION, 'all-platforms') )
if: success()
with:
name: wazuh-dashboard_${{ env.VERSION }}-${{ env.REVISION }}_amd64.deb
path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/output/deb/wazuh-dashboard_${{ env.VERSION }}-${{ env.REVISION }}_amd64.deb
path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/deb/output/wazuh-dashboard_${{ env.VERSION }}-${{ env.REVISION }}_amd64.deb
retention-days: 30


build-rpm-package:
needs: [Build-base-package]
if: ( contains(inputs.DISTRIBUTION, 'rpm') || contains(inputs.DISTRIBUTION, 'all-platforms') )
runs-on: ubuntu-latest
name: Build rpm package
strategy:
fail-fast: false
matrix:
ARCHITECTURE: [ x64 ]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Setup variables
run: |
echo "CURRENT_DIR=$(pwd -P)" >> $GITHUB_ENV
echo "VERSION=$(yarn --silent wzd-version)" >> $GITHUB_ENV
echo "REVISION=$(yarn --silent wzd-revision)" >> $GITHUB_ENV
- name: Download dashboard artifact
uses: actions/download-artifact@v3
with:
name: wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz
path: ${{ env.CURRENT_DIR }}/artifacts/dashboard-tar

- name: Build packages
run: |
cd ${{ env.CURRENT_DIR }}/dev-tools/build-packages/rpm/
bash ./launcher.sh \
-v ${{ env.VERSION }} \
-r ${{ env.REVISION }} \
-p file://${{env.CURRENT_DIR}}/artifacts/dashboard-tar/wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz
- name: Upload rpm packages
uses: actions/upload-artifact@v3
if: success() && ( contains(inputs.DISTRIBUTION, 'rpm') || contains(inputs.DISTRIBUTION, 'all-platforms') )
if: success()
with:
name: wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}.x86_64.rpm
path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/output/rpm/wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}.x86_64.rpm
path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/rpm/output/wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}.x86_64.rpm
retention-days: 30

0 comments on commit e6b2a7a

Please sign in to comment.