Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use short SHA as Git reference in packages naming #100

Merged
merged 4 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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