fix: make release workflow use dynamic package name from package.json
Changed hardcoded 'headlamp-sealed-secrets' references to dynamically read package name, allowing package.json name to be 'sealed-secrets'. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -24,6 +24,14 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Get package name
|
||||||
|
id: package_name
|
||||||
|
working-directory: ./headlamp-sealed-secrets
|
||||||
|
run: |
|
||||||
|
PKG_NAME=$(node -p "require('./package.json').name")
|
||||||
|
echo "name=${PKG_NAME}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Package name: ${PKG_NAME}"
|
||||||
|
|
||||||
- name: Configure git
|
- name: Configure git
|
||||||
run: |
|
run: |
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
@@ -38,7 +46,7 @@ jobs:
|
|||||||
- name: Update artifacthub-pkg.yml version
|
- name: Update artifacthub-pkg.yml version
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ inputs.version }}"
|
||||||
RELEASE_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}/headlamp-sealed-secrets-${VERSION}.tar.gz"
|
RELEASE_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}/${{ steps.package_name.outputs.name }}-${VERSION}.tar.gz"
|
||||||
|
|
||||||
sed -i "s|^version:.*|version: ${VERSION}|" artifacthub-pkg.yml
|
sed -i "s|^version:.*|version: ${VERSION}|" artifacthub-pkg.yml
|
||||||
sed -i "s|^appVersion:.*|appVersion: ${VERSION}|" artifacthub-pkg.yml
|
sed -i "s|^appVersion:.*|appVersion: ${VERSION}|" artifacthub-pkg.yml
|
||||||
@@ -74,7 +82,7 @@ jobs:
|
|||||||
- name: Move tarball to root
|
- name: Move tarball to root
|
||||||
working-directory: ./headlamp-sealed-secrets
|
working-directory: ./headlamp-sealed-secrets
|
||||||
run: |
|
run: |
|
||||||
TARBALL="headlamp-sealed-secrets-${{ inputs.version }}.tar.gz"
|
TARBALL="${{ steps.package_name.outputs.name }}-${{ inputs.version }}.tar.gz"
|
||||||
if [ ! -f "${TARBALL}" ]; then
|
if [ ! -f "${TARBALL}" ]; then
|
||||||
echo "::error::Expected tarball ${TARBALL} not found"
|
echo "::error::Expected tarball ${TARBALL} not found"
|
||||||
ls -la *.tar.gz
|
ls -la *.tar.gz
|
||||||
@@ -85,7 +93,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Validate tarball name
|
- name: Validate tarball name
|
||||||
run: |
|
run: |
|
||||||
EXPECTED="headlamp-sealed-secrets-${{ inputs.version }}.tar.gz"
|
EXPECTED="${{ steps.package_name.outputs.name }}-${{ inputs.version }}.tar.gz"
|
||||||
ACTUAL=$(ls *.tar.gz)
|
ACTUAL=$(ls *.tar.gz)
|
||||||
if [ "$EXPECTED" != "$ACTUAL" ]; then
|
if [ "$EXPECTED" != "$ACTUAL" ]; then
|
||||||
echo "::error::Tarball name mismatch! Expected: $EXPECTED, Got: $ACTUAL"
|
echo "::error::Tarball name mismatch! Expected: $EXPECTED, Got: $ACTUAL"
|
||||||
@@ -96,19 +104,19 @@ jobs:
|
|||||||
- name: Compute checksum
|
- name: Compute checksum
|
||||||
id: compute_checksum
|
id: compute_checksum
|
||||||
run: |
|
run: |
|
||||||
TARBALL="headlamp-sealed-secrets-${{ inputs.version }}.tar.gz"
|
TARBALL="${{ steps.package_name.outputs.name }}-${{ inputs.version }}.tar.gz"
|
||||||
CHECKSUM=$(sha256sum "$TARBALL" | awk '{print $1}')
|
CHECKSUM=$(sha256sum "$TARBALL" | awk '{print $1}')
|
||||||
echo "checksum=${CHECKSUM}" >> $GITHUB_OUTPUT
|
echo "checksum=${CHECKSUM}" >> $GITHUB_OUTPUT
|
||||||
echo "Checksum: sha256:${CHECKSUM}"
|
echo "Checksum: sha256:${CHECKSUM}"
|
||||||
|
|
||||||
- name: Verify tarball contents
|
- name: Verify tarball contents
|
||||||
run: |
|
run: |
|
||||||
TARBALL="headlamp-sealed-secrets-${{ inputs.version }}.tar.gz"
|
TARBALL="${{ steps.package_name.outputs.name }}-${{ inputs.version }}.tar.gz"
|
||||||
echo "Tarball contents:"
|
echo "Tarball contents:"
|
||||||
tar -tzf "${TARBALL}" | head -20
|
tar -tzf "${TARBALL}" | head -20
|
||||||
|
|
||||||
# Verify main.js exists (structure is headlamp-sealed-secrets/main.js)
|
# Verify main.js exists (structure is <package-name>/main.js)
|
||||||
if ! tar -tzf "${TARBALL}" | grep -q "headlamp-sealed-secrets/main.js"; then
|
if ! tar -tzf "${TARBALL}" | grep -q "${{ steps.package_name.outputs.name }}/main.js"; then
|
||||||
echo "::error::main.js not found in tarball"
|
echo "::error::main.js not found in tarball"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -134,7 +142,7 @@ jobs:
|
|||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
tag_name: "v${{ inputs.version }}"
|
tag_name: "v${{ inputs.version }}"
|
||||||
files: headlamp-sealed-secrets-${{ inputs.version }}.tar.gz
|
files: ${{ steps.package_name.outputs.name }}-${{ inputs.version }}.tar.gz
|
||||||
fail_on_unmatched_files: true
|
fail_on_unmatched_files: true
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
@@ -147,9 +155,9 @@ jobs:
|
|||||||
echo "Release Summary:"
|
echo "Release Summary:"
|
||||||
echo "=================="
|
echo "=================="
|
||||||
echo "Version: v${{ inputs.version }}"
|
echo "Version: v${{ inputs.version }}"
|
||||||
echo "Tarball: headlamp-sealed-secrets-${{ inputs.version }}.tar.gz"
|
echo "Tarball: ${{ steps.package_name.outputs.name }}-${{ inputs.version }}.tar.gz"
|
||||||
echo "Checksum: sha256:${{ steps.compute_checksum.outputs.checksum }}"
|
echo "Checksum: sha256:${{ steps.compute_checksum.outputs.checksum }}"
|
||||||
echo "Archive URL: https://github.com/${{ github.repository }}/releases/download/v${{ inputs.version }}/headlamp-sealed-secrets-${{ inputs.version }}.tar.gz"
|
echo "Archive URL: https://github.com/${{ github.repository }}/releases/download/v${{ inputs.version }}/${{ steps.package_name.outputs.name }}-${{ inputs.version }}.tar.gz"
|
||||||
echo ""
|
echo ""
|
||||||
echo "✓ Version bumped to ${{ inputs.version }}"
|
echo "✓ Version bumped to ${{ inputs.version }}"
|
||||||
echo "✓ Metadata updated with checksum"
|
echo "✓ Metadata updated with checksum"
|
||||||
|
|||||||
Reference in New Issue
Block a user