Skip to content

Commit

Permalink
Use short SHA as Git reference in packages naming (#100)
Browse files Browse the repository at this point in the history
* Switching to short SHA commit form in package names

Signed-off-by: Fede Tux <[email protected]>

* Update r_commit_sha.yml

Signed-off-by: Federico Gustavo Galland <[email protected]>

* Update r_commit_sha.yml

Signed-off-by: Álex Ruiz <[email protected]>

---------

Signed-off-by: Fede Tux <[email protected]>
Signed-off-by: Federico Gustavo Galland <[email protected]>
Signed-off-by: Álex Ruiz <[email protected]>
Co-authored-by: Fede Tux <[email protected]>
Co-authored-by: Álex Ruiz <[email protected]>
  • Loading branch information
3 people authored Jan 10, 2024
1 parent b596b00 commit 506cfa1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ jobs:
version:
uses: ./.github/workflows/r_version.yml

commit_sha:
uses: ./.github/workflows/r_commit_sha.yml

build:
needs: version
needs: [ version, commit_sha ]
strategy:
matrix:
distribution: [tar, rpm, deb]
Expand All @@ -37,10 +40,10 @@ jobs:
architecture: ${{ matrix.architecture }}
distribution: ${{ matrix.distribution }}
revision: ${{ inputs.revision }}
name: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ github.sha }}.${{ matrix.distribution }}
name: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }}

assemble:
needs: [version, build]
needs: [version, commit_sha, build]
strategy:
matrix:
distribution: [tar, rpm, deb]
Expand All @@ -54,4 +57,4 @@ jobs:
with:
architecture: ${{ matrix.architecture }}
distribution: ${{ matrix.distribution }}
min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ github.sha }}.${{ matrix.distribution }}
min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }}
22 changes: 22 additions & 0 deletions .github/workflows/r_commit_sha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Get commit's short SHA (reusable)"

# This workflow runs when any of the following occur:
# - Run from another workflow
on:
workflow_call:
outputs:
commit_sha:
description: "Returns the short SHA of the latest commit"
value: ${{ jobs.r_commit_sha.outputs.commit_sha }}

jobs:
r_commit_sha:
runs-on: ubuntu-latest
outputs:
commit_sha: ${{ steps.get_commit_sha.outputs.commit_sha }}
steps:
- uses: actions/checkout@v4
- name: Get git commit SHA
id: get_commit_sha
run: |
echo "commit_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

0 comments on commit 506cfa1

Please sign in to comment.