@@ -123,36 +123,40 @@ jobs:
123123
124124 cd "$WORKDIR"
125125
126+ PACKAGE_DIR="capsule"
126127 TEMPLATE_PKG=""
127- if [ -f artifacthub-pkg .template.yml ]; then
128- TEMPLATE_PKG="artifacthub-pkg .template.yml "
128+ if [ -f package .template ]; then
129+ TEMPLATE_PKG="package .template"
129130 fi
130131
131- if [ -z "$TEMPLATE_PKG" ] && [ -f artifacthub-pkg.yml ]; then
132- TEMPLATE_PKG="artifacthub-pkg.yml "
132+ if [ -z "$TEMPLATE_PKG" ] && [ -f "$PACKAGE_DIR/package.template" ]; then
133+ TEMPLATE_PKG="$PACKAGE_DIR/package.template "
133134 fi
134135
135136 if [ -z "$TEMPLATE_PKG" ]; then
136- TEMPLATE_PKG="$(find . -mindepth 2 -maxdepth 2 -name artifacthub-pkg.yml | sort -V | tail -n1)"
137+ TEMPLATE_PKG="$(find "$PACKAGE_DIR" -mindepth 2 -maxdepth 2 -name artifacthub-pkg.yml | sort -V | tail -n1)"
137138 fi
138139
139140 test -n "$TEMPLATE_PKG" || {
140141 echo "❌ No artifacthub-pkg.yml template found on artifacthub branch"
141142 exit 1
142143 }
143144
144- mkdir -p "$VERSION"
145- cp "$TEMPLATE_PKG" "$VERSION/artifacthub-pkg.yml"
145+ PACKAGE_VERSION_DIR="$PACKAGE_DIR/$VERSION"
146+ mkdir -p "$PACKAGE_VERSION_DIR"
147+ cp "$TEMPLATE_PKG" "$PACKAGE_VERSION_DIR/artifacthub-pkg.yml"
148+ cp "$GITHUB_WORKSPACE/README.md" "$PACKAGE_VERSION_DIR/README.md"
146149
147- yq -i '.version = strenv(VERSION)' "$VERSION /artifacthub-pkg.yml"
148- yq -i '.createdAt = strenv(CREATED_AT)' "$VERSION /artifacthub-pkg.yml"
149- yq -i '.annotations."headlamp/plugin/archive-url" = strenv(ARCHIVE_URL)' "$VERSION /artifacthub-pkg.yml"
150- yq -i '.annotations."headlamp/plugin/archive-checksum" = "sha256:" + strenv(CHECKSUM)' "$VERSION /artifacthub-pkg.yml"
150+ yq -i '.version = strenv(VERSION)' "$PACKAGE_VERSION_DIR /artifacthub-pkg.yml"
151+ yq -i '.createdAt = strenv(CREATED_AT)' "$PACKAGE_VERSION_DIR /artifacthub-pkg.yml"
152+ yq -i '.annotations."headlamp/plugin/archive-url" = strenv(ARCHIVE_URL)' "$PACKAGE_VERSION_DIR /artifacthub-pkg.yml"
153+ yq -i '.annotations."headlamp/plugin/archive-checksum" = "sha256:" + strenv(CHECKSUM)' "$PACKAGE_VERSION_DIR /artifacthub-pkg.yml"
151154 rm -f artifacthub-pkg.yml
155+ rm -f "$PACKAGE_DIR/artifacthub-pkg.yml"
152156
153157 echo "✅ Artifact Hub metadata published:"
154158 echo " version: $VERSION"
155- echo " path: $VERSION /artifacthub-pkg.yml"
159+ echo " path: $PACKAGE_VERSION_DIR /artifacthub-pkg.yml"
156160 echo " archive-url: $ARCHIVE_URL"
157161 echo " checksum: sha256:$CHECKSUM"
158162
@@ -170,6 +174,9 @@ jobs:
170174 username : ${{ github.repository_owner }}
171175 password : ${{ secrets.GITHUB_TOKEN }}
172176
177+ - name : Install Cosign
178+ uses : sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
179+
173180 - name : Build & push Docker image
174181 id : docker-build
175182 uses : docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
@@ -180,7 +187,17 @@ jobs:
180187 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.tag }}
181188 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
182189
183- - name : Generate container image attestation
190+ - name : Sign container image
191+ env :
192+ DIGEST : ${{ steps.docker-build.outputs.digest }}
193+ IMAGE : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
194+ TAG : ${{ steps.version.outputs.tag }}
195+ run : |
196+ cosign sign --yes \
197+ "${IMAGE}:${TAG}@${DIGEST}" \
198+ "${IMAGE}:latest@${DIGEST}"
199+
200+ - name : Generate and push container image attestation
184201 uses : actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0
185202 with :
186203 subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
0 commit comments