Skip to content

Commit 28062ca

Browse files
f-gallandFede TuxAlexRuiz7
committed
Use short SHA as Git reference in packages naming (#100)
* 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]>
1 parent 7d64527 commit 28062ca

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

.github/workflows/build.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ jobs:
2626
version:
2727
uses: ./.github/workflows/r_version.yml
2828

29+
commit_sha:
30+
uses: ./.github/workflows/r_commit_sha.yml
31+
2932
build:
30-
needs: version
33+
needs: [ version, commit_sha ]
3134
strategy:
3235
matrix:
3336
distribution: [tar, rpm, deb]
@@ -37,10 +40,10 @@ jobs:
3740
architecture: ${{ matrix.architecture }}
3841
distribution: ${{ matrix.distribution }}
3942
revision: ${{ inputs.revision }}
40-
name: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ github.sha }}.${{ matrix.distribution }}
43+
name: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }}
4144

4245
assemble:
43-
needs: [version, build]
46+
needs: [version, commit_sha, build]
4447
strategy:
4548
matrix:
4649
distribution: [tar, rpm, deb]
@@ -54,4 +57,4 @@ jobs:
5457
with:
5558
architecture: ${{ matrix.architecture }}
5659
distribution: ${{ matrix.distribution }}
57-
min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ github.sha }}.${{ matrix.distribution }}
60+
min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.distribution }}

.github/workflows/r_commit_sha.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Get commit's short SHA (reusable)"
2+
3+
# This workflow runs when any of the following occur:
4+
# - Run from another workflow
5+
on:
6+
workflow_call:
7+
outputs:
8+
commit_sha:
9+
description: "Returns the short SHA of the latest commit"
10+
value: ${{ jobs.r_commit_sha.outputs.commit_sha }}
11+
12+
jobs:
13+
r_commit_sha:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
commit_sha: ${{ steps.get_commit_sha.outputs.commit_sha }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Get git commit SHA
20+
id: get_commit_sha
21+
run: |
22+
echo "commit_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)