From c142fcd22bc2f609fc4dd08e209848002a12f525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Fri, 19 Jan 2024 17:01:02 +0100 Subject: [PATCH] Fix Build workflow to run on push events (#134) * Run workflow on push * Set build workflow inputs to required * Normalize the use of quotes for the build workflow inputs * Add ternary operator * Add missing ternary operator --- .github/workflows/build.yml | 16 +++++++++------- .github/workflows/r_assemble.yml | 10 +++++----- .github/workflows/r_build.yml | 13 ++++++++----- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96e6826794abc..2c05d48c4a507 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,17 +3,17 @@ name: Build packages # This workflow runs when any of the following occur: # - Run manually on: - pull_request: + push: # Sequence of patterns matched against refs/heads branches: - 'ci/*' workflow_dispatch: inputs: revision: - # description: - default: "1" - required: false + description: "Any string or number used to extend the package's identifier" type: string + required: true + default: "1" # ========================== # Bibliography @@ -25,6 +25,8 @@ on: # | https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-a-matrix-strategy-with-a-reusable-workflow # * Reading input from the called workflow # | https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_callinputs +# * Ternary operator +# | https://docs.github.com/en/actions/learn-github-actions/expressions#example jobs: version: @@ -43,8 +45,8 @@ jobs: with: architecture: ${{ matrix.architecture }} distribution: ${{ matrix.distribution }} - revision: ${{ inputs.revision }} - name: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} + revision: ${{ github.event_name == 'push' && '1' || inputs.revision }} + name: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} assemble: needs: [version, commit_sha, build] @@ -61,4 +63,4 @@ jobs: with: architecture: ${{ matrix.architecture }} distribution: ${{ matrix.distribution }} - min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} + min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }} diff --git a/.github/workflows/r_assemble.yml b/.github/workflows/r_assemble.yml index 82bfe9d0fe5a8..d08b64cea23ed 100644 --- a/.github/workflows/r_assemble.yml +++ b/.github/workflows/r_assemble.yml @@ -6,17 +6,17 @@ on: workflow_call: inputs: distribution: - description: 'One of [ "tar", "rpm", "deb" ]' + description: "One of [ 'tar', 'rpm', 'deb' ]" default: "rpm" - required: false + required: true type: string architecture: - description: 'One of [ "x64", "arm64" ]' + description: "One of [ 'x64', 'arm64' ]" default: "x64" - required: false + required: true type: string min: - description: The name of the package to download. + description: "The name of the package to download." required: true type: string diff --git a/.github/workflows/r_build.yml b/.github/workflows/r_build.yml index 104c0a7da22c1..299eb8155f735 100644 --- a/.github/workflows/r_build.yml +++ b/.github/workflows/r_build.yml @@ -6,19 +6,22 @@ on: workflow_call: inputs: distribution: - description: 'One of [ "tar", "rpm", "deb" ]' + description: "One of [ 'tar', 'rpm', 'deb' ]" default: "rpm" - required: false + required: true type: string architecture: - description: 'One of [ "x64", "arm64" ]' + description: "One of [ 'x64', 'arm64' ]" default: "x64" - required: false + required: true type: string revision: + description: "Any string or number used to extend the package's identifier." type: string + required: true + default: "1" name: - description: The name of the package to upload. + description: "The name of the package to upload." required: true type: string