fix(plugin-release): strip @scope and / from PKG_NAME for tarball matching (#124)

headlamp-plugin package strips the @ scope prefix and replaces / with -
when naming tarballs (e.g. @privilegedescalation/headlamp-argocd-plugin
becomes privilegedescalation-headlamp-argocd-plugin). The workflow was
using the raw package.json name without this transformation, causing
the Prepare release tarball step to fail when it couldn't find the
expected tarball file.

Co-authored-by: Chris Farhood <chris@farhood.org>
This commit is contained in:
privilegedescalation-engineer[bot]
2026-05-04 05:37:55 +00:00
committed by GitHub
parent 06e6784174
commit 2d791a8886
+4 -3
View File
@@ -208,7 +208,7 @@ jobs:
- name: Update artifacthub-pkg.yml
run: |
VERSION="${{ inputs.version }}"
PKG_NAME=$(jq -r .name package.json)
PKG_NAME=$(jq -r .name package.json | sed 's|^@||' | tr '/' '-')
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
@@ -241,9 +241,10 @@ jobs:
- name: Prepare release tarball
run: |
VERSION="${{ inputs.version }}"
PKG_NAME=$(jq -r .name package.json)
# 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 '/' '-')
TARBALL="${PKG_NAME}-${VERSION}.tar.gz"
# Rename tarball if headlamp-plugin produced a different name
for f in *.tar.gz; do
[ "$f" != "$TARBALL" ] && mv "$f" "$TARBALL"
done