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"