From 6fbcd383e74044299bc76c153c6162cfac9c68fa Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Mon, 27 Nov 2023 10:08:22 +0100 Subject: [PATCH] Change build slim action --- .github/workflows/build.yml | 41 ++++++++++++++++++++++++------------- package.json | 4 +++- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c6d17454276..857f1ace5b20 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,28 +3,31 @@ name: Build on: - workflow_dispatch + 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: - generate-linux-image: + build: runs-on: ubuntu-latest - name: Generate Linux image + name: Build defaults: run: working-directory: ./artifacts strategy: matrix: - include: - - name: Linux x64 - ext: tar.gz - suffix: linux-x64 - script: build-platform --linux --skip-os-packages --release + DISTRIBUTION: [ tar.gz ] + ARCHITECTURE: [ x64, arm64 ] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: ./artifacts + ref: ${{ inputs.CHECKOUT_TO }} - name: Setup Node uses: actions/setup-node@v3 @@ -52,20 +55,30 @@ jobs: - 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=opensearch-dashboards-${{ env.VERSION }}-${{ matrix.suffix }}.${{ matrix.ext }}" >> $GITHUB_ENV + 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 `${{ matrix.name }}` - run: yarn ${{ matrix.script }} --release + - 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: ${{ matrix.suffix }}-${{ env.VERSION }} + name: ${{ env.ARTIFACT_BUILD_NAME }} path: ./artifacts/target/${{ env.ARTIFACT_BUILD_NAME }} - retention-days: 30 \ No newline at end of file + retention-days: 30 diff --git a/package.json b/package.json index bbeda013f17b..c7c1e6f718f1 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,9 @@ "docs:acceptApiChanges": "scripts/use_node --max-old-space-size=6144 scripts/check_published_api_changes.js --accept", "osd:bootstrap": "scripts/use_node scripts/build_ts_refs && scripts/use_node scripts/register_git_hook", "spec_to_console": "scripts/use_node scripts/spec_to_console", - "pkg-version": "scripts/use_node -e \"console.log(require('./package.json').version)\"" + "pkg-version": "scripts/use_node -e \"console.log(require('./package.json').version)\"", + "wzd-revision": "scripts/use_node -e \"console.log(require('./package.json').wazuh.revision)\"", + "wzd-version": "scripts/use_node -e \"console.log(require('./package.json').wazuh.version)\"" }, "repository": { "type": "git",