From 1a7770b01fdf5484d0603e0198709b4105cb1862 Mon Sep 17 00:00:00 2001 From: "privilegedescalation-engineer[bot]" <269729446+privilegedescalation-engineer[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 11:40:15 +0000 Subject: [PATCH] fix: use artifacthub-pkg.yml name for archive-url (PRI-356) Both the Update artifacthub-pkg.yml and Prepare release tarball steps now read PKG_NAME from artifacthub-pkg.yml when present, falling back to package.json with correct @org/ prefix stripping. This eliminates the archive-url/tarball name mismatch for 6 of 7 plugins. Co-Authored-By: Paperclip --- .github/workflows/plugin-release.yaml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/plugin-release.yaml b/.github/workflows/plugin-release.yaml index 6662a31..18ee49d 100644 --- a/.github/workflows/plugin-release.yaml +++ b/.github/workflows/plugin-release.yaml @@ -208,7 +208,11 @@ jobs: - name: Update artifacthub-pkg.yml run: | VERSION="${{ inputs.version }}" - PKG_NAME=$(jq -r .name package.json | sed 's|^@||' | tr '/' '-') + if [ -f artifacthub-pkg.yml ]; then + PKG_NAME=$(grep '^name:' artifacthub-pkg.yml | cut -d: -f2 | tr -d ' "') + else + PKG_NAME=$(jq -r .name package.json | sed 's|^@[^/]*/||') + fi RELEASE_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}/${PKG_NAME}-${VERSION}.tar.gz" sed -i "s/^version:.*/version: \"${VERSION}\"/" artifacthub-pkg.yml sed -i "s|headlamp/plugin/archive-url:.*|headlamp/plugin/archive-url: \"${RELEASE_URL}\"|" artifacthub-pkg.yml @@ -255,9 +259,13 @@ jobs: - name: Prepare release tarball run: | VERSION="${{ inputs.version }}" - # headlamp-plugin strips the @ scope prefix and replaces / with - when naming tarballs. - # e.g. @privilegedescalation/headlamp-argocd-plugin -> privilegedescalation-headlamp-argocd-plugin - PKG_NAME=$(jq -r .name package.json | sed 's|^@||' | tr '/' '-') + # headlamp-plugin strips the @org/ prefix when naming tarballs. + # e.g. @privilegedescalation/headlamp-argocd-plugin -> headlamp-argocd-plugin + if [ -f artifacthub-pkg.yml ]; then + PKG_NAME=$(grep '^name:' artifacthub-pkg.yml | cut -d: -f2 | tr -d ' "') + else + PKG_NAME=$(jq -r .name package.json | sed 's|^@[^/]*/||') + fi TARBALL="${PKG_NAME}-${VERSION}.tar.gz" for f in *.tar.gz; do [ "$f" != "$TARBALL" ] && mv "$f" "$TARBALL"