@@ -461,13 +461,46 @@ jobs:
461461 with :
462462 fetch-depth : 0
463463
464+ - name : Clean charts directory
465+ run : |
466+ rm -rf charts/
467+ mkdir -p charts/
468+
464469 - name : Download Helm chart artifact
465470 uses : actions/download-artifact@v7
466471 with :
467472 name : helm-chart
468473 path : charts/
469474 continue-on-error : true
470475
476+ - name : Filter current version chart files
477+ id : chart_files
478+ run : |
479+ VERSION="${{ needs.prepare.outputs.version }}"
480+ CHART_NAME="cloud-cert-renewer"
481+ EXPECTED_FILE="${CHART_NAME}-${VERSION}.tgz"
482+
483+ # Remove any files that don't match the current version
484+ if [ -f "charts/${EXPECTED_FILE}" ]; then
485+ # Keep only the current version file
486+ find charts/ -name "*.tgz" ! -name "${EXPECTED_FILE}" -delete
487+ echo "file=${EXPECTED_FILE}" >> $GITHUB_OUTPUT
488+ echo "Found and kept: ${EXPECTED_FILE}"
489+ else
490+ # If exact match not found, list all files for debugging
491+ echo "Warning: Expected file ${EXPECTED_FILE} not found"
492+ ls -la charts/ || true
493+ # Use the first .tgz file found as fallback
494+ FIRST_FILE=$(ls charts/*.tgz 2>/dev/null | head -n1)
495+ if [ -n "$FIRST_FILE" ]; then
496+ echo "file=$(basename $FIRST_FILE)" >> $GITHUB_OUTPUT
497+ echo "Using fallback: $(basename $FIRST_FILE)"
498+ else
499+ echo "file=" >> $GITHUB_OUTPUT
500+ echo "No chart files found"
501+ fi
502+ fi
503+
471504 - name : Create Git tag
472505 env :
473506 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -548,6 +581,76 @@ jobs:
548581 echo "CUSTOM_SECTION_EOF"
549582 } >> $GITHUB_OUTPUT
550583
584+ - name : Create source code archive
585+ id : source_archive
586+ run : |
587+ VERSION="${{ needs.prepare.outputs.version }}"
588+ TAG="${{ needs.prepare.outputs.tag }}"
589+ ARCHIVE_NAME="cloud-cert-renewer-${VERSION}.tar.gz"
590+
591+ # Fetch the tag if it was just created
592+ git fetch origin "${TAG}" 2>/dev/null || true
593+
594+ # Create source code archive from the tag
595+ # Try tag first, fallback to HEAD if tag doesn't exist locally yet
596+ if git rev-parse "${TAG}" >/dev/null 2>&1; then
597+ echo "Creating archive from tag: ${TAG}"
598+ git archive --format=tar.gz \
599+ --prefix=cloud-cert-renewer-${VERSION}/ \
600+ --output="${ARCHIVE_NAME}" \
601+ "${TAG}"
602+ else
603+ echo "Tag ${TAG} not found locally, using HEAD"
604+ git archive --format=tar.gz \
605+ --prefix=cloud-cert-renewer-${VERSION}/ \
606+ --output="${ARCHIVE_NAME}" \
607+ HEAD
608+ fi
609+
610+ # Verify archive was created
611+ if [ -f "${ARCHIVE_NAME}" ]; then
612+ ls -lh "${ARCHIVE_NAME}"
613+ echo "archive=${ARCHIVE_NAME}" >> $GITHUB_OUTPUT
614+ echo "Created source archive: ${ARCHIVE_NAME}"
615+ else
616+ echo "Error: Failed to create source archive"
617+ exit 1
618+ fi
619+
620+ - name : Generate checksums
621+ id : checksums
622+ run : |
623+ VERSION="${{ needs.prepare.outputs.version }}"
624+ CHART_FILE="charts/cloud-cert-renewer-${VERSION}.tgz"
625+ SOURCE_ARCHIVE="${{ steps.source_archive.outputs.archive }}"
626+ CHECKSUMS_FILE="checksums.txt"
627+
628+ # Create checksums file
629+ echo "# SHA256 Checksums for Release ${{ needs.prepare.outputs.tag }}" > "${CHECKSUMS_FILE}"
630+ echo "# Generated on $(date -u +"%Y-%m-%d %H:%M:%S UTC")" >> "${CHECKSUMS_FILE}"
631+ echo "" >> "${CHECKSUMS_FILE}"
632+
633+ # Calculate checksums for all release artifacts
634+ # Use basename for cleaner output (just filename, not path)
635+ if [ -f "${SOURCE_ARCHIVE}" ]; then
636+ SHA256=$(sha256sum "${SOURCE_ARCHIVE}" | cut -d' ' -f1)
637+ FILENAME=$(basename "${SOURCE_ARCHIVE}")
638+ echo "${SHA256} ${FILENAME}" >> "${CHECKSUMS_FILE}"
639+ echo "Added checksum for source archive: ${FILENAME}"
640+ fi
641+
642+ if [ -f "${CHART_FILE}" ]; then
643+ SHA256=$(sha256sum "${CHART_FILE}" | cut -d' ' -f1)
644+ FILENAME=$(basename "${CHART_FILE}")
645+ echo "${SHA256} ${FILENAME}" >> "${CHECKSUMS_FILE}"
646+ echo "Added checksum for Helm chart: ${FILENAME}"
647+ fi
648+
649+ # Display checksums file
650+ echo "Generated checksums:"
651+ cat "${CHECKSUMS_FILE}"
652+ echo "checksums=${CHECKSUMS_FILE}" >> $GITHUB_OUTPUT
653+
551654 - name : Create GitHub Release
552655 uses : softprops/action-gh-release@v2
553656 with :
@@ -587,7 +690,14 @@ jobs:
587690 - Package: `cloud-cert-renewer==${{ needs.prepare.outputs.version }}`
588691 - Install: `pip install cloud-cert-renewer==${{ needs.prepare.outputs.version }}`
589692 - URL: https://pypi.org/project/cloud-cert-renewer/
590- files : charts/*.tgz
693+
694+ ### Source Code
695+ - Source archive: `cloud-cert-renewer-${{ needs.prepare.outputs.version }}.tar.gz`
696+ - Checksums: `checksums.txt` (SHA256)
697+ files : |
698+ ${{ steps.source_archive.outputs.archive }}
699+ ${{ steps.checksums.outputs.checksums }}
700+ charts/cloud-cert-renewer-${{ needs.prepare.outputs.version }}.tgz
591701 draft : false
592702 prerelease : ${{ needs.prepare.outputs.is_prerelease == 'true' }}
593703 env :
0 commit comments