Skip to content

Commit 5977b62

Browse files
authored
Use git short hash for image tag; remove confusing release name from CI: (tinkerbell#23)
## Description The OCI image tag doesn't need the whole git hash, short hash is better. Removing the release name from the CI artifacts job as it is confusing as it's not a GitHub release nor related to git tagging. Fixes: # ## How Has This Been Tested? ## How are existing users impacted? What migration steps/scripts do we need? ## Checklist: I have: - [ ] updated the documentation and/or roadmap (if required) - [ ] added unit or e2e tests - [ ] provided instructions on how to upgrade
2 parents 867304d + 161f6b1 commit 5977b62

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,9 @@ jobs:
302302
retention-days: 1
303303

304304
# -------------------------------------------------------------------
305-
# Collect release artifacts and compute checksums
305+
# Publish artifacts and compute checksums
306306
# -------------------------------------------------------------------
307-
release-artifacts:
307+
publish-artifacts:
308308
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
309309
needs: [build-iso]
310310
strategy:
@@ -354,13 +354,6 @@ jobs:
354354
out/initramfs-${{ matrix.arch }}.cpio.zst \
355355
out/captainos-${{ matrix.arch }}.iso
356356
357-
- name: Upload release artifacts
358-
uses: actions/upload-artifact@v4
359-
with:
360-
name: release-${{ matrix.arch }}
361-
path: out/
362-
retention-days: 1
363-
364357
- name: Log in to GHCR
365358
if: github.ref == 'refs/heads/main'
366359
uses: docker/login-action@v3
@@ -373,11 +366,15 @@ jobs:
373366
if: github.ref == 'refs/heads/main'
374367
uses: oras-project/setup-oras@v1
375368

376-
- name: Push release artifacts to GHCR
369+
- name: Compute short SHA
370+
id: short-sha
371+
run: echo "sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
372+
373+
- name: Push artifacts to GHCR
377374
if: github.ref == 'refs/heads/main'
378375
run: |
379376
oras push \
380-
ghcr.io/${{ github.repository }}/${{ env.OCI_ARTIFACT_NAME }}:${{ github.sha }}-${{ matrix.arch }} \
377+
ghcr.io/${{ github.repository }}/${{ env.OCI_ARTIFACT_NAME }}:${{ steps.short-sha.outputs.sha }}-${{ matrix.arch }} \
381378
--annotation org.opencontainers.image.source=https://github.com/${{ github.repository }} \
382379
--annotation org.opencontainers.image.revision=${{ github.sha }} \
383380
out/vmlinuz-${{ matrix.arch }} \

.github/workflows/release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@ jobs:
2828
- name: Load shared config
2929
run: cat .github/config.env >> "$GITHUB_ENV"
3030

31+
- name: Compute short SHA
32+
id: short-sha
33+
run: echo "sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
34+
3135
- name: Pull release artifacts (amd64)
32-
run: oras pull ghcr.io/${{ github.repository }}/${{ env.OCI_ARTIFACT_NAME }}:${{ github.sha }}-amd64 -o artifacts/amd64/
36+
run: oras pull ghcr.io/${{ github.repository }}/${{ env.OCI_ARTIFACT_NAME }}:${{ steps.short-sha.outputs.sha }}-amd64 -o artifacts/amd64/
3337

3438
- name: Pull release artifacts (arm64)
35-
run: oras pull ghcr.io/${{ github.repository }}/${{ env.OCI_ARTIFACT_NAME }}:${{ github.sha }}-arm64 -o artifacts/arm64/
39+
run: oras pull ghcr.io/${{ github.repository }}/${{ env.OCI_ARTIFACT_NAME }}:${{ steps.short-sha.outputs.sha }}-arm64 -o artifacts/arm64/
3640

3741
- name: Create GitHub Release
3842
env:
@@ -47,8 +51,8 @@ jobs:
4751
- name: Tag OCI artifacts with version
4852
run: |
4953
oras tag \
50-
ghcr.io/${{ github.repository }}/${{ env.OCI_ARTIFACT_NAME }}:${{ github.sha }}-amd64 \
54+
ghcr.io/${{ github.repository }}/${{ env.OCI_ARTIFACT_NAME }}:${{ steps.short-sha.outputs.sha }}-amd64 \
5155
${{ github.ref_name }}-amd64
5256
oras tag \
53-
ghcr.io/${{ github.repository }}/${{ env.OCI_ARTIFACT_NAME }}:${{ github.sha }}-arm64 \
57+
ghcr.io/${{ github.repository }}/${{ env.OCI_ARTIFACT_NAME }}:${{ steps.short-sha.outputs.sha }}-arm64 \
5458
${{ github.ref_name }}-arm64

0 commit comments

Comments
 (0)