Skip to content

Commit

Permalink
Fix Build workflow to run on push events (#134)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
AlexRuiz7 committed Jun 28, 2024
1 parent 45f872b commit a705980
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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]
Expand All @@ -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 }}
10 changes: 5 additions & 5 deletions .github/workflows/r_assemble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/r_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a705980

Please sign in to comment.