Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Commit 29d6160

Browse files
committed
build: use short commit id
1 parent 97f12ff commit 29d6160

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/pkg.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ jobs:
1919
- name: Checkout repository
2020
uses: actions/checkout@v4
2121
with:
22-
fetch-depth: 0 # get full history to create short-commit-ids
22+
fetch-depth: 0 # Fetch all history for tags
23+
24+
- name: Get short commit hash
25+
id: short_sha
26+
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
2327

2428
- name: Log in to the Container registry
2529
uses: docker/login-action@v2
@@ -35,14 +39,13 @@ jobs:
3539
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3640
tags: |
3741
${{ github.ref == 'refs/heads/master' && 'latest' || '' }}
38-
${{ github.ref_type == 'tag' && github.ref_name || format('{0}-{1}', github.head_ref || github.ref_name, github.sha) }}
42+
${{ github.ref_type == 'tag' && github.ref_name || format('{0}-{1}', github.head_ref || github.ref_name, steps.short_sha.outputs.SHORT_SHA) }}
3943
labels: |
4044
org.label-schema.schema-version=1.0
4145
org.label-schema.vcs-url=${{ github.server_url }}/${{ github.repository }}
4246
org.label-schema.vcs-ref=${{ github.sha }}
4347
org.label-schema.build-date=${{ github.event.push.head_commit.timestamp }}
4448
45-
4649
- name: Build and push Docker image
4750
uses: docker/build-push-action@v4
4851
with:

0 commit comments

Comments
 (0)